/* Options:
Date: 2025-04-08 18:21:01
SwiftVersion: 5.0
Version: 8.23
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://api.bokamera.se

//BaseClass: 
//AddModelExtensions: True
//AddServiceStackTypes: True
IncludeTypes: CategoryQuery.*
//ExcludeTypes: 
//ExcludeGenericBaseTypes: False
//AddResponseStatus: False
//AddImplicitVersion: 
//AddDescriptionAsComments: True
//InitializeCollections: True
//TreatTypesAsStrings: 
//DefaultImports: Foundation,ServiceStack
*/

import Foundation
import ServiceStack

// @Route("/categories", "GET")
public class CategoryQuery : QueryDb2<CompanyCategory, CategoryQueryResponse>, IReturn
{
    public typealias Return = QueryResponse<CategoryQueryResponse>

    /**
    * Id of the category
    */
    // @ApiMember(Description="Id of the category")
    public var id:Int?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class CompanyCategory : BaseModel
{
    // @Required()
    public var name:String?

    // @Required()
    public var header:String?

    // @Required()
    public var Description:String?

    public var imageUrl:Uri
    // @Required()
    public var active:Bool?

    public var sortOrder:Int?
    public var modifiedDate:Date?
    public var id:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case name
        case header
        case Description
        case imageUrl
        case active
        case sortOrder
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        header = try container.decodeIfPresent(String.self, forKey: .header)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        imageUrl = try container.decodeIfPresent(Uri.self, forKey: .imageUrl)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        sortOrder = try container.decodeIfPresent(Int.self, forKey: .sortOrder)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if name != nil { try container.encode(name, forKey: .name) }
        if header != nil { try container.encode(header, forKey: .header) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) }
        if active != nil { try container.encode(active, forKey: .active) }
        if sortOrder != nil { try container.encode(sortOrder, forKey: .sortOrder) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class CategoryQueryResponse : Codable
{
    public var id:Int
    public var name:String
    public var Description:String
    public var header:String
    public var imageUrl:Uri
    public var active:Bool
    public var responseStatus:ResponseStatus

    required public init(){}
}

public class BaseModel : Codable
{
    required public init(){}
}