//
// MemberGroupSharedItem.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//

import AnyCodable
import Foundation
import Vapor

/** Information about items shared among groups. */
public final class MemberGroupSharedItem: Content, Hashable {
    public var errorDetails: ErrorDetails?
    public var group: Group?
    /** How the item is shared. One of:   - `not_shared`: The item is not shared.  - `shared_to`: The item is shared. */
    public var shared: String?

    public init(errorDetails: ErrorDetails? = nil, group: Group? = nil, shared: String? = nil) {
        self.errorDetails = errorDetails
        self.group = group
        self.shared = shared
    }

    public enum CodingKeys: String, CodingKey, CaseIterable {
        case errorDetails
        case group
        case shared
    }

    // Encodable protocol methods

    public func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encodeIfPresent(errorDetails, forKey: .errorDetails)
        try container.encodeIfPresent(group, forKey: .group)
        try container.encodeIfPresent(shared, forKey: .shared)
    }

    public static func == (lhs: MemberGroupSharedItem, rhs: MemberGroupSharedItem) -> Bool {
        lhs.errorDetails == rhs.errorDetails &&
            lhs.group == rhs.group &&
            lhs.shared == rhs.shared
    }

    public func hash(into hasher: inout Hasher) {
        hasher.combine(errorDetails?.hashValue)
        hasher.combine(group?.hashValue)
        hasher.combine(shared?.hashValue)
    }
}
