//
//  StatusState.swift
//  Pachyderm
//
//  Created by Shadowfacts on 11/24/19.
//  Copyright © 2019 Shadowfacts. All rights reserved.
//

import Foundation

public class StatusState: Equatable, Hashable {
    public var collapsible: Bool?
    public var collapsed: Bool?

    public var unknown: Bool {
        collapsible == nil || collapsed == nil
    }
    
    public init(collapsible: Bool?, collapsed: Bool?) {
        self.collapsible = collapsible
        self.collapsed = collapsed
    }
    
    public func copy() -> StatusState {
        return StatusState(collapsible: self.collapsible, collapsed: self.collapsed)
    }
    
    public func hash(into hasher: inout Hasher) {
        hasher.combine(collapsible)
        hasher.combine(collapsed)
    }

    public static var unknown: StatusState {
        StatusState(collapsible: nil, collapsed: nil)
    }
    
    public static func == (lhs: StatusState, rhs: StatusState) -> Bool {
        lhs.collapsible == rhs.collapsible && lhs.collapsed == rhs.collapsed
    }
}