//
// Generated by SwagGen
// https://github.com/yonaskolb/SwagGen
//

import Foundation

public class ProfileDetail: ProfileSummary {

    /** A map of watched itemIds => last watched position */
    public var watched: [String: Watched]

    /** A map of rated itemIds => rating out of 10 */
    public var rated: [String: Int]

    /** A map of bookmarked itemIds => created date */
    public var bookmarked: [String: DateTime]

    public init(id: String, name: String, isActive: Bool, pinEnabled: Bool, purchaseEnabled: Bool, marketingEnabled: Bool, segments: [String], watched: [String: Watched], rated: [String: Int], bookmarked: [String: DateTime], maxRatingContentFilter: ClassificationSummary? = nil, minRatingPlaybackGuard: ClassificationSummary? = nil) {
        self.watched = watched
        self.rated = rated
        self.bookmarked = bookmarked
        super.init(id: id, name: name, isActive: isActive, pinEnabled: pinEnabled, purchaseEnabled: purchaseEnabled, marketingEnabled: marketingEnabled, segments: segments, maxRatingContentFilter: maxRatingContentFilter, minRatingPlaybackGuard: minRatingPlaybackGuard)
    }

    public required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: StringCodingKey.self)

        watched = try container.decode("watched")
        rated = try container.decode("rated")
        bookmarked = try container.decode("bookmarked")
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: StringCodingKey.self)

        try container.encode(watched, forKey: "watched")
        try container.encode(rated, forKey: "rated")
        try container.encode(bookmarked, forKey: "bookmarked")
        try super.encode(to: encoder)
    }

    override public func isEqual(to object: Any?) -> Bool {
      guard let object = object as? ProfileDetail else { return false }
      guard self.watched == object.watched else { return false }
      guard self.rated == object.rated else { return false }
      guard self.bookmarked == object.bookmarked else { return false }
      return super.isEqual(to: object)
    }
}
