<commit_before>//
//  Event.swift
//  Eurofurence
//
//  Copyright © 2017 Eurofurence. All rights reserved.
//

import Foundation

class Event: EntityBase {
	override class var DataModelVersion: Int { return 2 + super.DataModelVersion }

	var Abstract: String = ""
	var BannerImageId: String = ""
    var ConferenceDayId: String = ""
    var ConferenceTrackId: String = ""
    var ConferenceRoomId: String = ""
    var Description: String = ""
	var Duration: TimeInterval = 0.0
	var EndDateTimeUtc: Date = Date()
	var EndTime: String = ""
	var IsDeviatingFromConBook: Bool = false
    var PanelHosts: String = ""
	var PosterImageId: String = ""
    var Slug: String = ""
	var SubTitle: String = ""
	var StartDateTimeUtc: Date = Date()
	var StartTime: String = ""
    var Title: String = ""

	var _EventFavorite: EventFavorite?
	var IsFavorite: Bool { get { return _EventFavorite?.IsFavorite ?? false } }

	weak var BannerImage: Image?
    weak var ConferenceDay: EventConferenceDay?
    weak var ConferenceTrack: EventConferenceTrack?
	weak var ConferenceRoom: EventConferenceRoom?
	weak var PosterImage: Image?

	override public func propertyMapping() -> [(keyInObject: String?,
		keyInResource: String?)] {
			return [(keyInObject: "BannerImage", keyInResource: nil),
			        (keyInObject: "ConferenceDay", keyInResource: nil),
			        (keyInObject: "ConferenceTrack", keyInResource: nil),
			        (keyInObject: "ConferenceRoom", keyInResource: nil),
			        (keyInObject: "PosterImage", keyInResource: nil),
			        (keyInObject: "_EventFavorite", keyInResource: nil)]
	}

	override func propertyConverters() -> [(key: String, decodeConverter: ((Any?) -> Void), encodeConverter: (() -> Any?))] {
		return [
			(key: "Duration",
			 decodeConverter: {
				guard let timeString = $0 as? String else { return }
				self.Duration = TimeInterval.init(timeString: timeString) },
			 encodeConverter: { return "\(self.Duration.hoursPart):\(self.Duration.minutesPart):\(self.Duration.secondsPart)"})
		]
	}
}

extension Event: Sortable {
	override public func lessThan(_ rhs: EntityBase) -> Bool {
		return (rhs as? Event).map {<commit_msg>Proxy setter added for Event.IsFavorite<commit_after>//
//  Event.swift
//  Eurofurence
//
//  Copyright © 2017 Eurofurence. All rights reserved.
//

import Foundation

class Event: EntityBase {
	override class var DataModelVersion: Int { return 2 + super.DataModelVersion }

	var Abstract: String = ""
	var BannerImageId: String = ""
    var ConferenceDayId: String = ""
    var ConferenceTrackId: String = ""
    var ConferenceRoomId: String = ""
    var Description: String = ""
	var Duration: TimeInterval = 0.0
	var EndDateTimeUtc: Date = Date()
	var EndTime: String = ""
	var IsDeviatingFromConBook: Bool = false
    var PanelHosts: String = ""
	var PosterImageId: String = ""
    var Slug: String = ""
	var SubTitle: String = ""
	var StartDateTimeUtc: Date = Date()
	var StartTime: String = ""
    var Title: String = ""

	var _EventFavorite: EventFavorite?
	var IsFavorite: Bool {
		get { return _EventFavorite?.IsFavorite ?? false }
		set(value) { _EventFavorite?.IsFavorite = value }
	}

	weak var BannerImage: Image?
    weak var ConferenceDay: EventConferenceDay?
    weak var ConferenceTrack: EventConferenceTrack?
	weak var ConferenceRoom: EventConferenceRoom?
	weak var PosterImage: Image?

	override public func propertyMapping() -> [(keyInObject: String?,
		keyInResource: String?)] {
			return [(keyInObject: "BannerImage", keyInResource: nil),
			        (keyInObject: "ConferenceDay", keyInResource: nil),
			        (keyInObject: "ConferenceTrack", keyInResource: nil),
			        (keyInObject: "ConferenceRoom", keyInResource: nil),
			        (keyInObject: "IsFavorite", keyInResource: nil),
			        (keyInObject: "PosterImage", keyInResource: nil),
			        (keyInObject: "_EventFavorite", keyInResource: nil)]
	}

	override func propertyConverters() -> [(key: String, decodeConverter: ((Any?) -> Void), encodeConverter: (() -> Any?))] {
		return [
			(key: "Duration",
			 decodeConverter: {
				guard let timeString = $0 as? String else { return }
				self.Duration = TimeInterval.init(timeString: timeString) },
			 encodeConverter: { return "\(self.Duration.hoursPart):\(self.Duration.minutesPart):\(self.Duration.secondsPart)"})
		]
	}
}

extension Event: Sortable {
	override public func lessThan(_ rhs: EntityBase) -> Bool {
		return (rhs as? Event).map {
{'fraction_non_alphanumeric': 0.12249493357351948, 'fraction_numerical': 0.0036027921639270434, 'mean_word_length': 3.8974641675854467, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1065290', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1315, 'n_words': 377}