BokaMera.API.Host

<back to all web services

SuperAdminSupportCaseQuery

Requires Authentication
Requires the role:superadmin
The following routes are available for this service:
GET/superadmin/support/casesGet company support casesGet company support cases.
import Foundation
import ServiceStack

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class SuperAdminSupportCaseQuery : QueryDb2<SupportCase, SupportCaseQueryResponse>, ICompany
{
    /**
    * The company id, if empty will use the company id for the user you are logged in with.
    */
    // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    public var companyId:String?

    /**
    * If you want to search on active support cases
    */
    // @ApiMember(DataType="boolean", Description="If you want to search on active support cases", ParameterType="query")
    public var active:Bool?

    /**
    * Support Case Id
    */
    // @ApiMember(DataType="int", Description="Support Case Id", ParameterType="query")
    public var id:Int?

    /**
    * If you want to include the support case comments
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case comments", ParameterType="query")
    public var includeComments:Bool

    /**
    * If you want to include the support case status information
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case status information", ParameterType="query")
    public var includeCaseStatusInformation:Bool

    /**
    * If you want to include the support case type information
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case type information", ParameterType="query")
    public var includeCaseTypeInformation:Bool

    /**
    * If you want to include the support case area information
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case area information", ParameterType="query")
    public var includeCaseAreaInformation:Bool

    /**
    * If you want to include the support case comments
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case comments", ParameterType="query")
    public var includeCaseComments:Bool

    /**
    * If you want to include the support case attachments
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case attachments", ParameterType="query")
    public var includeCaseAttachments:Bool

    /**
    * If you want to include the support case status  options to select from
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case status  options to select from", ParameterType="query")
    public var includeCaseStatusOptions:Bool

    /**
    * If you want to include the support case type  options to select from
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case type  options to select from", ParameterType="query")
    public var includeCaseTypeOptions:Bool

    /**
    * If you want to include the support case area options to select from
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the support case area options to select from", ParameterType="query")
    public var includeCaseAreaOptions:Bool

    public var responseStatus:ResponseStatus

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case active
        case id
        case includeComments
        case includeCaseStatusInformation
        case includeCaseTypeInformation
        case includeCaseAreaInformation
        case includeCaseComments
        case includeCaseAttachments
        case includeCaseStatusOptions
        case includeCaseTypeOptions
        case includeCaseAreaOptions
        case responseStatus
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        includeComments = try container.decodeIfPresent(Bool.self, forKey: .includeComments)
        includeCaseStatusInformation = try container.decodeIfPresent(Bool.self, forKey: .includeCaseStatusInformation)
        includeCaseTypeInformation = try container.decodeIfPresent(Bool.self, forKey: .includeCaseTypeInformation)
        includeCaseAreaInformation = try container.decodeIfPresent(Bool.self, forKey: .includeCaseAreaInformation)
        includeCaseComments = try container.decodeIfPresent(Bool.self, forKey: .includeCaseComments)
        includeCaseAttachments = try container.decodeIfPresent(Bool.self, forKey: .includeCaseAttachments)
        includeCaseStatusOptions = try container.decodeIfPresent(Bool.self, forKey: .includeCaseStatusOptions)
        includeCaseTypeOptions = try container.decodeIfPresent(Bool.self, forKey: .includeCaseTypeOptions)
        includeCaseAreaOptions = try container.decodeIfPresent(Bool.self, forKey: .includeCaseAreaOptions)
        responseStatus = try container.decodeIfPresent(ResponseStatus.self, forKey: .responseStatus)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if active != nil { try container.encode(active, forKey: .active) }
        if id != nil { try container.encode(id, forKey: .id) }
        if includeComments != nil { try container.encode(includeComments, forKey: .includeComments) }
        if includeCaseStatusInformation != nil { try container.encode(includeCaseStatusInformation, forKey: .includeCaseStatusInformation) }
        if includeCaseTypeInformation != nil { try container.encode(includeCaseTypeInformation, forKey: .includeCaseTypeInformation) }
        if includeCaseAreaInformation != nil { try container.encode(includeCaseAreaInformation, forKey: .includeCaseAreaInformation) }
        if includeCaseComments != nil { try container.encode(includeCaseComments, forKey: .includeCaseComments) }
        if includeCaseAttachments != nil { try container.encode(includeCaseAttachments, forKey: .includeCaseAttachments) }
        if includeCaseStatusOptions != nil { try container.encode(includeCaseStatusOptions, forKey: .includeCaseStatusOptions) }
        if includeCaseTypeOptions != nil { try container.encode(includeCaseTypeOptions, forKey: .includeCaseTypeOptions) }
        if includeCaseAreaOptions != nil { try container.encode(includeCaseAreaOptions, forKey: .includeCaseAreaOptions) }
        if responseStatus != nil { try container.encode(responseStatus, forKey: .responseStatus) }
    }
}

public class SupportCase : BaseModel
{
    // @References(typeof(CaseArea))
    public var caseAreaId:Int

    public var caseArea:CaseArea
    // @References(typeof(CaseType))
    public var caseTypeId:Int

    public var caseType:CaseType
    // @References(typeof(CaseStatus))
    public var caseStatusId:Int

    public var caseStatus:CaseStatus
    // @Ignore()
    public var comments:IList<CaseComment>

    // @Ignore()
    public var caseAreaOptions:IList<CaseArea>

    // @Ignore()
    public var caseTypeOptions:IList<CaseType>

    // @Ignore()
    public var caseStatusOptions:IList<CaseStatus>

    // @Ignore()
    public var attachments:IList<CaseAttachment>

    public var attachmentRelation:[CaseAttachmentRelation] = []
    public var companyUser:CompanyUser
    public var company:Company
    // @Ignore()
    public var active:Bool

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

    public var id:Int
    public var companyUserId:String
    // @Required()
    public var title:String?

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

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

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

    public var solvedBy:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var caseOwner:String
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case caseAreaId
        case caseArea
        case caseTypeId
        case caseType
        case caseStatusId
        case caseStatus
        case comments
        case caseAreaOptions
        case caseTypeOptions
        case caseStatusOptions
        case attachments
        case attachmentRelation
        case companyUser
        case company
        case active
        case companyId
        case id
        case companyUserId
        case title
        case Description
        case createdBy
        case updatedBy
        case solvedBy
        case updated
        case created
        case caseOwner
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        caseAreaId = try container.decodeIfPresent(Int.self, forKey: .caseAreaId)
        caseArea = try container.decodeIfPresent(CaseArea.self, forKey: .caseArea)
        caseTypeId = try container.decodeIfPresent(Int.self, forKey: .caseTypeId)
        caseType = try container.decodeIfPresent(CaseType.self, forKey: .caseType)
        caseStatusId = try container.decodeIfPresent(Int.self, forKey: .caseStatusId)
        caseStatus = try container.decodeIfPresent(CaseStatus.self, forKey: .caseStatus)
        comments = try container.decodeIfPresent(IList<CaseComment>.self, forKey: .comments)
        caseAreaOptions = try container.decodeIfPresent(IList<CaseArea>.self, forKey: .caseAreaOptions)
        caseTypeOptions = try container.decodeIfPresent(IList<CaseType>.self, forKey: .caseTypeOptions)
        caseStatusOptions = try container.decodeIfPresent(IList<CaseStatus>.self, forKey: .caseStatusOptions)
        attachments = try container.decodeIfPresent(IList<CaseAttachment>.self, forKey: .attachments)
        attachmentRelation = try container.decodeIfPresent([CaseAttachmentRelation].self, forKey: .attachmentRelation) ?? []
        companyUser = try container.decodeIfPresent(CompanyUser.self, forKey: .companyUser)
        company = try container.decodeIfPresent(Company.self, forKey: .company)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        companyUserId = try container.decodeIfPresent(String.self, forKey: .companyUserId)
        title = try container.decodeIfPresent(String.self, forKey: .title)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy)
        updatedBy = try container.decodeIfPresent(String.self, forKey: .updatedBy)
        solvedBy = try container.decodeIfPresent(String.self, forKey: .solvedBy)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        caseOwner = try container.decodeIfPresent(String.self, forKey: .caseOwner)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if caseAreaId != nil { try container.encode(caseAreaId, forKey: .caseAreaId) }
        if caseArea != nil { try container.encode(caseArea, forKey: .caseArea) }
        if caseTypeId != nil { try container.encode(caseTypeId, forKey: .caseTypeId) }
        if caseType != nil { try container.encode(caseType, forKey: .caseType) }
        if caseStatusId != nil { try container.encode(caseStatusId, forKey: .caseStatusId) }
        if caseStatus != nil { try container.encode(caseStatus, forKey: .caseStatus) }
        if comments != nil { try container.encode(comments, forKey: .comments) }
        if caseAreaOptions != nil { try container.encode(caseAreaOptions, forKey: .caseAreaOptions) }
        if caseTypeOptions != nil { try container.encode(caseTypeOptions, forKey: .caseTypeOptions) }
        if caseStatusOptions != nil { try container.encode(caseStatusOptions, forKey: .caseStatusOptions) }
        if attachments != nil { try container.encode(attachments, forKey: .attachments) }
        if attachmentRelation.count > 0 { try container.encode(attachmentRelation, forKey: .attachmentRelation) }
        if companyUser != nil { try container.encode(companyUser, forKey: .companyUser) }
        if company != nil { try container.encode(company, forKey: .company) }
        if active != nil { try container.encode(active, forKey: .active) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if companyUserId != nil { try container.encode(companyUserId, forKey: .companyUserId) }
        if title != nil { try container.encode(title, forKey: .title) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if createdBy != nil { try container.encode(createdBy, forKey: .createdBy) }
        if updatedBy != nil { try container.encode(updatedBy, forKey: .updatedBy) }
        if solvedBy != nil { try container.encode(solvedBy, forKey: .solvedBy) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if caseOwner != nil { try container.encode(caseOwner, forKey: .caseOwner) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case color
        case icon
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        color = try container.decodeIfPresent(String.self, forKey: .color)
        icon = try container.decodeIfPresent(String.self, forKey: .icon)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if color != nil { try container.encode(color, forKey: .color) }
        if icon != nil { try container.encode(icon, forKey: .icon) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class CaseComment : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var supportCaseId:Int?

    public var id:Int
    // @Required()
    public var comment:String?

    // @Required()
    public var deleted:Bool?

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

    // @Required()
    public var created:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case supportCaseId
        case id
        case comment
        case deleted
        case createdBy
        case created
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        supportCaseId = try container.decodeIfPresent(Int.self, forKey: .supportCaseId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        comment = try container.decodeIfPresent(String.self, forKey: .comment)
        deleted = try container.decodeIfPresent(Bool.self, forKey: .deleted)
        createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

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

public class CaseAttachment : BaseModel
{
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var fileUrl:String?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case fileUrl
        case modifiedDate
    }

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

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

public class CaseAttachmentRelation : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var caseAttachmentId:Int?

    // @Required()
    public var supportCaseId:Int?

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case caseAttachmentId
        case supportCaseId
        case id
        case modifiedDate
    }

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

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

public class CompanyUser : BaseModel, IUser, IBaseModelCreated, IBaseModelUpdated
{
    public var resource:Resource
    // @Ignore()
    public var roles:[KeyCloakRole] = []

    public var email:String
    public var resourceId:Int?
    public var workerId:String
    // @Required()
    public var active:Bool?

    // @Required()
    public var isSuperAdmin:Bool?

    // @Required()
    public var createdDate:Date?

    // @Required()
    public var updatedDate:Date?

    public var modifiedDate:Date?
    // @Required()
    public var companyId:String?

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

    public var userId:String
    public var firstname:String
    public var lastname:String
    public var phone:String

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

    private enum CodingKeys : String, CodingKey {
        case resource
        case roles
        case email
        case resourceId
        case workerId
        case active
        case isSuperAdmin
        case createdDate
        case updatedDate
        case modifiedDate
        case companyId
        case id
        case userId
        case firstname
        case lastname
        case phone
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        resource = try container.decodeIfPresent(Resource.self, forKey: .resource)
        roles = try container.decodeIfPresent([KeyCloakRole].self, forKey: .roles) ?? []
        email = try container.decodeIfPresent(String.self, forKey: .email)
        resourceId = try container.decodeIfPresent(Int.self, forKey: .resourceId)
        workerId = try container.decodeIfPresent(String.self, forKey: .workerId)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        isSuperAdmin = try container.decodeIfPresent(Bool.self, forKey: .isSuperAdmin)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        userId = try container.decodeIfPresent(String.self, forKey: .userId)
        firstname = try container.decodeIfPresent(String.self, forKey: .firstname)
        lastname = try container.decodeIfPresent(String.self, forKey: .lastname)
        phone = try container.decodeIfPresent(String.self, forKey: .phone)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if resource != nil { try container.encode(resource, forKey: .resource) }
        if roles.count > 0 { try container.encode(roles, forKey: .roles) }
        if email != nil { try container.encode(email, forKey: .email) }
        if resourceId != nil { try container.encode(resourceId, forKey: .resourceId) }
        if workerId != nil { try container.encode(workerId, forKey: .workerId) }
        if active != nil { try container.encode(active, forKey: .active) }
        if isSuperAdmin != nil { try container.encode(isSuperAdmin, forKey: .isSuperAdmin) }
        if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
        if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if userId != nil { try container.encode(userId, forKey: .userId) }
        if firstname != nil { try container.encode(firstname, forKey: .firstname) }
        if lastname != nil { try container.encode(lastname, forKey: .lastname) }
        if phone != nil { try container.encode(phone, forKey: .phone) }
    }
}

public class Resource : BaseModel, ICustomFieldTable, IBaseModelCreated, IBaseModelUpdated
{
    // @Ignore()
    public var priority:Int

    // @Ignore()
    public var schedules:IList<ISchedule>

    // @Ignore()
    public var exceptions:IList<ITimeException>

    // @Ignore()
    public var bookings:IList<IBookedTime>

    // @Ignore()
    public var customFieldsConfig:IList<CustomFieldConfig>

    // @Ignore()
    public var customFieldsData:IList<CustomFieldDataResponse>

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

    public var id:Int
    // @Required()
    public var name:String?

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

    public var Description:String
    public var imageUrl:String
    // @Required()
    public var updatedDate:Date?

    // @Required()
    public var createdDate:Date?

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

    public var email:String
    public var mobilePhone:String
    public var emailNotification:Bool?
    public var smsNotification:Bool?
    // @Required()
    public var sendSMSReminder:Bool?

    // @Required()
    public var sendEmailReminder:Bool?

    public var modifiedDate:Date?
    public var accessGroup:String
    public var textField1:String
    public var textField2:String
    public var textField3:String
    public var textField4:String
    public var textField5:String
    public var textField6:String
    public var textField7:String
    public var textField8:String
    public var textField9:String
    public var textField10:String
    public var textField11:String
    public var textField12:String
    public var textField13:String
    public var textField14:String
    public var textField15:String
    public var textField16:String
    public var textField17:String
    public var textField18:String
    public var textField19:String
    public var textField20:String

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

    private enum CodingKeys : String, CodingKey {
        case priority
        case schedules
        case exceptions
        case bookings
        case customFieldsConfig
        case customFieldsData
        case companyId
        case id
        case name
        case active
        case Description
        case imageUrl
        case updatedDate
        case createdDate
        case color
        case email
        case mobilePhone
        case emailNotification
        case smsNotification
        case sendSMSReminder
        case sendEmailReminder
        case modifiedDate
        case accessGroup
        case textField1
        case textField2
        case textField3
        case textField4
        case textField5
        case textField6
        case textField7
        case textField8
        case textField9
        case textField10
        case textField11
        case textField12
        case textField13
        case textField14
        case textField15
        case textField16
        case textField17
        case textField18
        case textField19
        case textField20
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        priority = try container.decodeIfPresent(Int.self, forKey: .priority)
        schedules = try container.decodeIfPresent(IList<ISchedule>.self, forKey: .schedules)
        exceptions = try container.decodeIfPresent(IList<ITimeException>.self, forKey: .exceptions)
        bookings = try container.decodeIfPresent(IList<IBookedTime>.self, forKey: .bookings)
        customFieldsConfig = try container.decodeIfPresent(IList<CustomFieldConfig>.self, forKey: .customFieldsConfig)
        customFieldsData = try container.decodeIfPresent(IList<CustomFieldDataResponse>.self, forKey: .customFieldsData)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl)
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        color = try container.decodeIfPresent(String.self, forKey: .color)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        mobilePhone = try container.decodeIfPresent(String.self, forKey: .mobilePhone)
        emailNotification = try container.decodeIfPresent(Bool.self, forKey: .emailNotification)
        smsNotification = try container.decodeIfPresent(Bool.self, forKey: .smsNotification)
        sendSMSReminder = try container.decodeIfPresent(Bool.self, forKey: .sendSMSReminder)
        sendEmailReminder = try container.decodeIfPresent(Bool.self, forKey: .sendEmailReminder)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        accessGroup = try container.decodeIfPresent(String.self, forKey: .accessGroup)
        textField1 = try container.decodeIfPresent(String.self, forKey: .textField1)
        textField2 = try container.decodeIfPresent(String.self, forKey: .textField2)
        textField3 = try container.decodeIfPresent(String.self, forKey: .textField3)
        textField4 = try container.decodeIfPresent(String.self, forKey: .textField4)
        textField5 = try container.decodeIfPresent(String.self, forKey: .textField5)
        textField6 = try container.decodeIfPresent(String.self, forKey: .textField6)
        textField7 = try container.decodeIfPresent(String.self, forKey: .textField7)
        textField8 = try container.decodeIfPresent(String.self, forKey: .textField8)
        textField9 = try container.decodeIfPresent(String.self, forKey: .textField9)
        textField10 = try container.decodeIfPresent(String.self, forKey: .textField10)
        textField11 = try container.decodeIfPresent(String.self, forKey: .textField11)
        textField12 = try container.decodeIfPresent(String.self, forKey: .textField12)
        textField13 = try container.decodeIfPresent(String.self, forKey: .textField13)
        textField14 = try container.decodeIfPresent(String.self, forKey: .textField14)
        textField15 = try container.decodeIfPresent(String.self, forKey: .textField15)
        textField16 = try container.decodeIfPresent(String.self, forKey: .textField16)
        textField17 = try container.decodeIfPresent(String.self, forKey: .textField17)
        textField18 = try container.decodeIfPresent(String.self, forKey: .textField18)
        textField19 = try container.decodeIfPresent(String.self, forKey: .textField19)
        textField20 = try container.decodeIfPresent(String.self, forKey: .textField20)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if priority != nil { try container.encode(priority, forKey: .priority) }
        if schedules != nil { try container.encode(schedules, forKey: .schedules) }
        if exceptions != nil { try container.encode(exceptions, forKey: .exceptions) }
        if bookings != nil { try container.encode(bookings, forKey: .bookings) }
        if customFieldsConfig != nil { try container.encode(customFieldsConfig, forKey: .customFieldsConfig) }
        if customFieldsData != nil { try container.encode(customFieldsData, forKey: .customFieldsData) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if name != nil { try container.encode(name, forKey: .name) }
        if active != nil { try container.encode(active, forKey: .active) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) }
        if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
        if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
        if color != nil { try container.encode(color, forKey: .color) }
        if email != nil { try container.encode(email, forKey: .email) }
        if mobilePhone != nil { try container.encode(mobilePhone, forKey: .mobilePhone) }
        if emailNotification != nil { try container.encode(emailNotification, forKey: .emailNotification) }
        if smsNotification != nil { try container.encode(smsNotification, forKey: .smsNotification) }
        if sendSMSReminder != nil { try container.encode(sendSMSReminder, forKey: .sendSMSReminder) }
        if sendEmailReminder != nil { try container.encode(sendEmailReminder, forKey: .sendEmailReminder) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if accessGroup != nil { try container.encode(accessGroup, forKey: .accessGroup) }
        if textField1 != nil { try container.encode(textField1, forKey: .textField1) }
        if textField2 != nil { try container.encode(textField2, forKey: .textField2) }
        if textField3 != nil { try container.encode(textField3, forKey: .textField3) }
        if textField4 != nil { try container.encode(textField4, forKey: .textField4) }
        if textField5 != nil { try container.encode(textField5, forKey: .textField5) }
        if textField6 != nil { try container.encode(textField6, forKey: .textField6) }
        if textField7 != nil { try container.encode(textField7, forKey: .textField7) }
        if textField8 != nil { try container.encode(textField8, forKey: .textField8) }
        if textField9 != nil { try container.encode(textField9, forKey: .textField9) }
        if textField10 != nil { try container.encode(textField10, forKey: .textField10) }
        if textField11 != nil { try container.encode(textField11, forKey: .textField11) }
        if textField12 != nil { try container.encode(textField12, forKey: .textField12) }
        if textField13 != nil { try container.encode(textField13, forKey: .textField13) }
        if textField14 != nil { try container.encode(textField14, forKey: .textField14) }
        if textField15 != nil { try container.encode(textField15, forKey: .textField15) }
        if textField16 != nil { try container.encode(textField16, forKey: .textField16) }
        if textField17 != nil { try container.encode(textField17, forKey: .textField17) }
        if textField18 != nil { try container.encode(textField18, forKey: .textField18) }
        if textField19 != nil { try container.encode(textField19, forKey: .textField19) }
        if textField20 != nil { try container.encode(textField20, forKey: .textField20) }
    }
}

public protocol ISchedule
{
    var resources:IList<Resource> { get set }
    var type:ScheduleType { get set }
    var active:Bool { get set }
    var isResourceSpecific:Bool { get set }

}

public enum ScheduleType : String, Codable
{
    case NotDefined
    case RecurringSchedule
    case DateSchedule
}

public protocol ITimeException : IInterval
{
    var id:Int { get set }
    var reasonText:String { get set }
    var isBlock:Bool { get set }
    var reasonTextPublic:String { get set }
    var isRecurring:Bool { get set }
    var resourceIds:[Int] { get set }

}

public protocol IBookedTime : IInterval
{
    var id:Int { get set }
    var serviceId:Int { get set }
    var bookedSpots:Int { get set }
    var totalSpots:Int { get set }
    var pauseAfterInMinutes:Int { get set }
    var status:BookingStatusEnum { get set }
    var statusId:Int { get set }
    var customer:BookedCustomer { get set }

}

public enum BookingStatusEnum : Int, Codable
{
    case Booked = 1
    case Unbooked = 2
    case Reserved = 3
    case Canceled = 4
    case AwaitingPayment = 5
    case AwaitingPaymentNoTimeLimit = 6
    case Payed = 7
    case AwaitingPaymentRequestFromAdmin = 8
    case AwaitingPaymentFromProvider = 9
    case Invoiced = 10
}

public class BookedCustomer : Codable
{
    public var id:String
    public var firstname:String
    public var lastname:String
    public var email:String
    public var phone:String
    public var facebookUserName:String
    public var imageUrl:String
    public var corporateIdentityNumber:String
    public var invoiceAddress1:String
    public var invoiceAddress2:String
    public var invoiceCity:String
    public var invoicePostalCode:String
    public var invoiceCountryCode:String

    required public init(){}
}

public class CustomFieldConfig : BaseModel
{
    // @Ignore()
    public var values:[CustomFieldValue] = []

    public var customField:CustomField
    // @Ignore()
    public var regEx:RegEx

    // @Ignore()
    public var services:[Service] = []

    public var customFieldServiceRelation:[CustomFieldServiceRelation] = []
    // @Required()
    public var companyId:String?

    public var id:Int
    public var groupId:Int?
    // @Required()
    public var fieldId:Int?

    // @Required()
    public var iconId:Int?

    public var regExId:Int?
    // @Required()
    public var name:String?

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

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

    // @Required()
    public var maxLength:Int?

    // @Required()
    public var isPublic:Bool?

    // @Required()
    public var isHidden:Bool?

    // @Required()
    public var isMandatory:Bool?

    public var defaultValue:String
    public var regExErrorMessage:String
    public var mandatoryErrorMessage:String
    public var width:Int?
    // @Required()
    public var multipleLineText:Bool?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case values
        case customField
        case regEx
        case services
        case customFieldServiceRelation
        case companyId
        case id
        case groupId
        case fieldId
        case iconId
        case regExId
        case name
        case Description
        case datatype
        case maxLength
        case isPublic
        case isHidden
        case isMandatory
        case defaultValue
        case regExErrorMessage
        case mandatoryErrorMessage
        case width
        case multipleLineText
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        values = try container.decodeIfPresent([CustomFieldValue].self, forKey: .values) ?? []
        customField = try container.decodeIfPresent(CustomField.self, forKey: .customField)
        regEx = try container.decodeIfPresent(RegEx.self, forKey: .regEx)
        services = try container.decodeIfPresent([Service].self, forKey: .services) ?? []
        customFieldServiceRelation = try container.decodeIfPresent([CustomFieldServiceRelation].self, forKey: .customFieldServiceRelation) ?? []
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        groupId = try container.decodeIfPresent(Int.self, forKey: .groupId)
        fieldId = try container.decodeIfPresent(Int.self, forKey: .fieldId)
        iconId = try container.decodeIfPresent(Int.self, forKey: .iconId)
        regExId = try container.decodeIfPresent(Int.self, forKey: .regExId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        datatype = try container.decodeIfPresent(String.self, forKey: .datatype)
        maxLength = try container.decodeIfPresent(Int.self, forKey: .maxLength)
        isPublic = try container.decodeIfPresent(Bool.self, forKey: .isPublic)
        isHidden = try container.decodeIfPresent(Bool.self, forKey: .isHidden)
        isMandatory = try container.decodeIfPresent(Bool.self, forKey: .isMandatory)
        defaultValue = try container.decodeIfPresent(String.self, forKey: .defaultValue)
        regExErrorMessage = try container.decodeIfPresent(String.self, forKey: .regExErrorMessage)
        mandatoryErrorMessage = try container.decodeIfPresent(String.self, forKey: .mandatoryErrorMessage)
        width = try container.decodeIfPresent(Int.self, forKey: .width)
        multipleLineText = try container.decodeIfPresent(Bool.self, forKey: .multipleLineText)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if values.count > 0 { try container.encode(values, forKey: .values) }
        if customField != nil { try container.encode(customField, forKey: .customField) }
        if regEx != nil { try container.encode(regEx, forKey: .regEx) }
        if services.count > 0 { try container.encode(services, forKey: .services) }
        if customFieldServiceRelation.count > 0 { try container.encode(customFieldServiceRelation, forKey: .customFieldServiceRelation) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if groupId != nil { try container.encode(groupId, forKey: .groupId) }
        if fieldId != nil { try container.encode(fieldId, forKey: .fieldId) }
        if iconId != nil { try container.encode(iconId, forKey: .iconId) }
        if regExId != nil { try container.encode(regExId, forKey: .regExId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if datatype != nil { try container.encode(datatype, forKey: .datatype) }
        if maxLength != nil { try container.encode(maxLength, forKey: .maxLength) }
        if isPublic != nil { try container.encode(isPublic, forKey: .isPublic) }
        if isHidden != nil { try container.encode(isHidden, forKey: .isHidden) }
        if isMandatory != nil { try container.encode(isMandatory, forKey: .isMandatory) }
        if defaultValue != nil { try container.encode(defaultValue, forKey: .defaultValue) }
        if regExErrorMessage != nil { try container.encode(regExErrorMessage, forKey: .regExErrorMessage) }
        if mandatoryErrorMessage != nil { try container.encode(mandatoryErrorMessage, forKey: .mandatoryErrorMessage) }
        if width != nil { try container.encode(width, forKey: .width) }
        if multipleLineText != nil { try container.encode(multipleLineText, forKey: .multipleLineText) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class CustomFieldValue : BaseModel
{
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var value:String?

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

    public var sortOrder:Int16?
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case value
        case active
        case sortOrder
        case modifiedDate
    }

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

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if value != nil { try container.encode(value, forKey: .value) }
        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) }
    }
}

public class CustomField : BaseModel
{
    // @Required()
    public var table:String?

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

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case table
        case column
        case dataType
        case Description
        case active
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        table = try container.decodeIfPresent(String.self, forKey: .table)
        column = try container.decodeIfPresent(String.self, forKey: .column)
        dataType = try container.decodeIfPresent(String.self, forKey: .dataType)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        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 table != nil { try container.encode(table, forKey: .table) }
        if column != nil { try container.encode(column, forKey: .column) }
        if dataType != nil { try container.encode(dataType, forKey: .dataType) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if active != nil { try container.encode(active, forKey: .active) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var errorMessage:String
    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case regExCode
        case errorMessage
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        regExCode = try container.decodeIfPresent(String.self, forKey: .regExCode)
        errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if regExCode != nil { try container.encode(regExCode, forKey: .regExCode) }
        if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class ResourceType : BaseModel, IBaseModelCreated, IBaseModelUpdated
{
    // @Ignore()
    public var selectableByUser:Bool

    // @Ignore()
    public var resources:[Resource] = []

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

    public var id:Int
    // @Required()
    public var name:String?

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

    // @Required()
    public var updatedDate:Date?

    // @Required()
    public var createdDate:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case selectableByUser
        case resources
        case companyId
        case id
        case name
        case Description
        case active
        case updatedDate
        case createdDate
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        selectableByUser = try container.decodeIfPresent(Bool.self, forKey: .selectableByUser)
        resources = try container.decodeIfPresent([Resource].self, forKey: .resources) ?? []
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if selectableByUser != nil { try container.encode(selectableByUser, forKey: .selectableByUser) }
        if resources.count > 0 { try container.encode(resources, forKey: .resources) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if name != nil { try container.encode(name, forKey: .name) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if active != nil { try container.encode(active, forKey: .active) }
        if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
        if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class TotalPriceInformation : Codable
{
    public var totalPrice:Double
    public var totalVATAmount:Double
    public var totalRebate:Double
    public var totalPriceBeforeRebate:Double
    public var appliedCodes:[AppliedRebateCodes] = []
    public var priceSign:String
    public var currencyId:String
    public var vat:Double

    required public init(){}
}

public class AppliedRebateCodes : Codable
{
    public var rebateCodeId:Int
    public var rebateCodeSign:String
    public var rebateCodeValue:Int
    public var rebateAmount:Double
    public var rebateCodeType:RebateCodeType

    required public init(){}
}

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

    public var Description:String
    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class ServicePrice : BaseModel, IInterval
{
    // @References(typeof(Currency))
    public var currencyId:String

    public var currencyInfo:Currency
    // @Ignore()
    public var service:Service

    // @Ignore()
    public var priceMappings:[PriceMapping] = []

    // @Ignore()
    public var isTimeSpecific:Bool

    // @Ignore()
    public var isDaysOfWeekSpecific:Bool

    public var dayOfWeeks:[ServicePriceDayOfWeekRelation] = []
    // @Ignore()
    public var priceBeforeRebate:Double?

    // @Ignore()
    public var rebateCodesApplied:[RebateCode] = []

    // @Ignore()
    public var priceText:String

    // @Ignore()
    public var isWeighted:Bool

    // @Ignore()
    public var overlappingPrices:[ServicePrice] = []

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

    public var id:Int
    // @Required()
    public var serviceId:Int?

    public var price:Double?
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    // @Required()
    @TimeSpan public var fromTime:TimeInterval?

    // @Required()
    @TimeSpan public var toTime:TimeInterval?

    // @Required()
    public var vat:Double?

    public var category:String
    public var modifiedDate:Date?
    // @Required()
    public var from:Date?

    // @Required()
    public var to:Date?

    // @Required()
    public var calculationTypeId:Int?

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

    private enum CodingKeys : String, CodingKey {
        case currencyId
        case currencyInfo
        case service
        case priceMappings
        case isTimeSpecific
        case isDaysOfWeekSpecific
        case dayOfWeeks
        case priceBeforeRebate
        case rebateCodesApplied
        case priceText
        case isWeighted
        case overlappingPrices
        case companyId
        case id
        case serviceId
        case price
        case updated
        case created
        case fromTime
        case toTime
        case vat
        case category
        case modifiedDate
        case from
        case to
        case calculationTypeId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
        currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
        service = try container.decodeIfPresent(Service.self, forKey: .service)
        priceMappings = try container.decodeIfPresent([PriceMapping].self, forKey: .priceMappings) ?? []
        isTimeSpecific = try container.decodeIfPresent(Bool.self, forKey: .isTimeSpecific)
        isDaysOfWeekSpecific = try container.decodeIfPresent(Bool.self, forKey: .isDaysOfWeekSpecific)
        dayOfWeeks = try container.decodeIfPresent([ServicePriceDayOfWeekRelation].self, forKey: .dayOfWeeks) ?? []
        priceBeforeRebate = try container.decodeIfPresent(Double.self, forKey: .priceBeforeRebate)
        rebateCodesApplied = try container.decodeIfPresent([RebateCode].self, forKey: .rebateCodesApplied) ?? []
        priceText = try container.decodeIfPresent(String.self, forKey: .priceText)
        isWeighted = try container.decodeIfPresent(Bool.self, forKey: .isWeighted)
        overlappingPrices = try container.decodeIfPresent([ServicePrice].self, forKey: .overlappingPrices) ?? []
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        serviceId = try container.decodeIfPresent(Int.self, forKey: .serviceId)
        price = try container.decodeIfPresent(Double.self, forKey: .price)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        fromTime = try container.convertIfPresent(TimeInterval.self, forKey: .fromTime)
        toTime = try container.convertIfPresent(TimeInterval.self, forKey: .toTime)
        vat = try container.decodeIfPresent(Double.self, forKey: .vat)
        category = try container.decodeIfPresent(String.self, forKey: .category)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        from = try container.decodeIfPresent(Date.self, forKey: .from)
        to = try container.decodeIfPresent(Date.self, forKey: .to)
        calculationTypeId = try container.decodeIfPresent(Int.self, forKey: .calculationTypeId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
        if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
        if service != nil { try container.encode(service, forKey: .service) }
        if priceMappings.count > 0 { try container.encode(priceMappings, forKey: .priceMappings) }
        if isTimeSpecific != nil { try container.encode(isTimeSpecific, forKey: .isTimeSpecific) }
        if isDaysOfWeekSpecific != nil { try container.encode(isDaysOfWeekSpecific, forKey: .isDaysOfWeekSpecific) }
        if dayOfWeeks.count > 0 { try container.encode(dayOfWeeks, forKey: .dayOfWeeks) }
        if priceBeforeRebate != nil { try container.encode(priceBeforeRebate, forKey: .priceBeforeRebate) }
        if rebateCodesApplied.count > 0 { try container.encode(rebateCodesApplied, forKey: .rebateCodesApplied) }
        if priceText != nil { try container.encode(priceText, forKey: .priceText) }
        if isWeighted != nil { try container.encode(isWeighted, forKey: .isWeighted) }
        if overlappingPrices.count > 0 { try container.encode(overlappingPrices, forKey: .overlappingPrices) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if serviceId != nil { try container.encode(serviceId, forKey: .serviceId) }
        if price != nil { try container.encode(price, forKey: .price) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if fromTime != nil { try container.encode(fromTime, forKey: .fromTime) }
        if toTime != nil { try container.encode(toTime, forKey: .toTime) }
        if vat != nil { try container.encode(vat, forKey: .vat) }
        if category != nil { try container.encode(category, forKey: .category) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if from != nil { try container.encode(from, forKey: .from) }
        if to != nil { try container.encode(to, forKey: .to) }
        if calculationTypeId != nil { try container.encode(calculationTypeId, forKey: .calculationTypeId) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case currencySign
        case active
        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)
        currencySign = try container.decodeIfPresent(String.self, forKey: .currencySign)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(String.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 currencySign != nil { try container.encode(currencySign, forKey: .currencySign) }
        if active != nil { try container.encode(active, forKey: .active) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class PriceMapping : BaseModel
{
    // @Required()
    public var companyId:String?

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

    // @Required()
    public var priceId:Int?

    public var referenceType:String
    public var externalReference:String
    // @Required()
    public var updatedDate:Date?

    // @Required()
    public var createdDate:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case priceId
        case referenceType
        case externalReference
        case updatedDate
        case createdDate
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        priceId = try container.decodeIfPresent(Int.self, forKey: .priceId)
        referenceType = try container.decodeIfPresent(String.self, forKey: .referenceType)
        externalReference = try container.decodeIfPresent(String.self, forKey: .externalReference)
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

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

public class ServicePriceDayOfWeekRelation : BaseModel
{
    // @Ignore()
    public var dayOfWeek:BokaMeraDayOfWeek

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

    // @Required()
    public var servicePriceId:Int?

    // @Required()
    public var dayOfWeekId:Int?

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case dayOfWeek
        case companyId
        case servicePriceId
        case dayOfWeekId
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dayOfWeek = try container.decodeIfPresent(BokaMeraDayOfWeek.self, forKey: .dayOfWeek)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        servicePriceId = try container.decodeIfPresent(Int.self, forKey: .servicePriceId)
        dayOfWeekId = try container.decodeIfPresent(Int.self, forKey: .dayOfWeekId)
        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 dayOfWeek != nil { try container.encode(dayOfWeek, forKey: .dayOfWeek) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if servicePriceId != nil { try container.encode(servicePriceId, forKey: .servicePriceId) }
        if dayOfWeekId != nil { try container.encode(dayOfWeekId, forKey: .dayOfWeekId) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public enum BokaMeraDayOfWeek : Int, Codable
{
    case Monday = 1
    case Tuesday = 2
    case Wednesday = 3
    case Thursday = 4
    case Friday = 5
    case Saturday = 6
    case Sunday = 7
}

public class RebateCode : BaseModel
{
    // @References(typeof(RebateCodeType))
    public var rebateCodeTypeId:Int

    public var rebateCodeTypeInfo:RebateCodeType
    // @References(typeof(RebateCodeStatus))
    public var rebateCodeStatusId:Int

    public var rebateCodeStatusInfo:RebateCodeType
    // @Ignore()
    public var services:[Service] = []

    public var rebateCodeDayOfWeekRelation:[RebateCodeDayOfWeekRelation] = []
    public var rebateCodeServiceRelation:[RebateCodeServiceRelation] = []
    public var rebateCodeBookingPriceRelation:[RebateCodeBookingPriceRelation] = []
    public var rebateCodeCustomerRelation:[RebateCodeCustomerRelation] = []
    // @Ignore()
    public var daysOfWeek:[DaysOfWeek] = []

    // @Ignore()
    public var customers:[Customer] = []

    // @Ignore()
    public var rebateCodeStatus:RebateCodeStatus

    // @Ignore()
    public var rebateCodeType:RebateCodeType

    // @Ignore()
    public var currentNumberOfUsesPerCustomer:Int

    // @Ignore()
    public var isSpecificByDayOfWeek:Bool

    // @Ignore()
    public var active:Bool

    public var companyId:String
    // @Required()
    public var validFrom:Date?

    // @Required()
    public var validTo:Date?

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

    // @Required()
    public var rebateCodeValue:Int?

    // @Required()
    public var maxNumberOfUses:Int?

    // @Required()
    public var maxNumberOfUsesPerCustomer:Int?

    // @Required()
    public var numberOfUsesUsed:Int?

    public var personalNote:String
    // @Required()
    public var createdBy:String?

    // @Required()
    public var created:Date?

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

    // @Required()
    public var updated:Date?

    // @Required()
    @TimeSpan public var fromTime:TimeInterval?

    // @Required()
    @TimeSpan public var toTime:TimeInterval?

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case rebateCodeTypeId
        case rebateCodeTypeInfo
        case rebateCodeStatusId
        case rebateCodeStatusInfo
        case services
        case rebateCodeDayOfWeekRelation
        case rebateCodeServiceRelation
        case rebateCodeBookingPriceRelation
        case rebateCodeCustomerRelation
        case daysOfWeek
        case customers
        case rebateCodeStatus
        case rebateCodeType
        case currentNumberOfUsesPerCustomer
        case isSpecificByDayOfWeek
        case active
        case companyId
        case validFrom
        case validTo
        case rebateCodeSign
        case rebateCodeValue
        case maxNumberOfUses
        case maxNumberOfUsesPerCustomer
        case numberOfUsesUsed
        case personalNote
        case createdBy
        case created
        case updatedBy
        case updated
        case fromTime
        case toTime
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        rebateCodeTypeId = try container.decodeIfPresent(Int.self, forKey: .rebateCodeTypeId)
        rebateCodeTypeInfo = try container.decodeIfPresent(RebateCodeType.self, forKey: .rebateCodeTypeInfo)
        rebateCodeStatusId = try container.decodeIfPresent(Int.self, forKey: .rebateCodeStatusId)
        rebateCodeStatusInfo = try container.decodeIfPresent(RebateCodeType.self, forKey: .rebateCodeStatusInfo)
        services = try container.decodeIfPresent([Service].self, forKey: .services) ?? []
        rebateCodeDayOfWeekRelation = try container.decodeIfPresent([RebateCodeDayOfWeekRelation].self, forKey: .rebateCodeDayOfWeekRelation) ?? []
        rebateCodeServiceRelation = try container.decodeIfPresent([RebateCodeServiceRelation].self, forKey: .rebateCodeServiceRelation) ?? []
        rebateCodeBookingPriceRelation = try container.decodeIfPresent([RebateCodeBookingPriceRelation].self, forKey: .rebateCodeBookingPriceRelation) ?? []
        rebateCodeCustomerRelation = try container.decodeIfPresent([RebateCodeCustomerRelation].self, forKey: .rebateCodeCustomerRelation) ?? []
        daysOfWeek = try container.decodeIfPresent([DaysOfWeek].self, forKey: .daysOfWeek) ?? []
        customers = try container.decodeIfPresent([Customer].self, forKey: .customers) ?? []
        rebateCodeStatus = try container.decodeIfPresent(RebateCodeStatus.self, forKey: .rebateCodeStatus)
        rebateCodeType = try container.decodeIfPresent(RebateCodeType.self, forKey: .rebateCodeType)
        currentNumberOfUsesPerCustomer = try container.decodeIfPresent(Int.self, forKey: .currentNumberOfUsesPerCustomer)
        isSpecificByDayOfWeek = try container.decodeIfPresent(Bool.self, forKey: .isSpecificByDayOfWeek)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        validFrom = try container.decodeIfPresent(Date.self, forKey: .validFrom)
        validTo = try container.decodeIfPresent(Date.self, forKey: .validTo)
        rebateCodeSign = try container.decodeIfPresent(String.self, forKey: .rebateCodeSign)
        rebateCodeValue = try container.decodeIfPresent(Int.self, forKey: .rebateCodeValue)
        maxNumberOfUses = try container.decodeIfPresent(Int.self, forKey: .maxNumberOfUses)
        maxNumberOfUsesPerCustomer = try container.decodeIfPresent(Int.self, forKey: .maxNumberOfUsesPerCustomer)
        numberOfUsesUsed = try container.decodeIfPresent(Int.self, forKey: .numberOfUsesUsed)
        personalNote = try container.decodeIfPresent(String.self, forKey: .personalNote)
        createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        updatedBy = try container.decodeIfPresent(String.self, forKey: .updatedBy)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        fromTime = try container.convertIfPresent(TimeInterval.self, forKey: .fromTime)
        toTime = try container.convertIfPresent(TimeInterval.self, forKey: .toTime)
        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 rebateCodeTypeId != nil { try container.encode(rebateCodeTypeId, forKey: .rebateCodeTypeId) }
        if rebateCodeTypeInfo != nil { try container.encode(rebateCodeTypeInfo, forKey: .rebateCodeTypeInfo) }
        if rebateCodeStatusId != nil { try container.encode(rebateCodeStatusId, forKey: .rebateCodeStatusId) }
        if rebateCodeStatusInfo != nil { try container.encode(rebateCodeStatusInfo, forKey: .rebateCodeStatusInfo) }
        if services.count > 0 { try container.encode(services, forKey: .services) }
        if rebateCodeDayOfWeekRelation.count > 0 { try container.encode(rebateCodeDayOfWeekRelation, forKey: .rebateCodeDayOfWeekRelation) }
        if rebateCodeServiceRelation.count > 0 { try container.encode(rebateCodeServiceRelation, forKey: .rebateCodeServiceRelation) }
        if rebateCodeBookingPriceRelation.count > 0 { try container.encode(rebateCodeBookingPriceRelation, forKey: .rebateCodeBookingPriceRelation) }
        if rebateCodeCustomerRelation.count > 0 { try container.encode(rebateCodeCustomerRelation, forKey: .rebateCodeCustomerRelation) }
        if daysOfWeek.count > 0 { try container.encode(daysOfWeek, forKey: .daysOfWeek) }
        if customers.count > 0 { try container.encode(customers, forKey: .customers) }
        if rebateCodeStatus != nil { try container.encode(rebateCodeStatus, forKey: .rebateCodeStatus) }
        if rebateCodeType != nil { try container.encode(rebateCodeType, forKey: .rebateCodeType) }
        if currentNumberOfUsesPerCustomer != nil { try container.encode(currentNumberOfUsesPerCustomer, forKey: .currentNumberOfUsesPerCustomer) }
        if isSpecificByDayOfWeek != nil { try container.encode(isSpecificByDayOfWeek, forKey: .isSpecificByDayOfWeek) }
        if active != nil { try container.encode(active, forKey: .active) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if validFrom != nil { try container.encode(validFrom, forKey: .validFrom) }
        if validTo != nil { try container.encode(validTo, forKey: .validTo) }
        if rebateCodeSign != nil { try container.encode(rebateCodeSign, forKey: .rebateCodeSign) }
        if rebateCodeValue != nil { try container.encode(rebateCodeValue, forKey: .rebateCodeValue) }
        if maxNumberOfUses != nil { try container.encode(maxNumberOfUses, forKey: .maxNumberOfUses) }
        if maxNumberOfUsesPerCustomer != nil { try container.encode(maxNumberOfUsesPerCustomer, forKey: .maxNumberOfUsesPerCustomer) }
        if numberOfUsesUsed != nil { try container.encode(numberOfUsesUsed, forKey: .numberOfUsesUsed) }
        if personalNote != nil { try container.encode(personalNote, forKey: .personalNote) }
        if createdBy != nil { try container.encode(createdBy, forKey: .createdBy) }
        if created != nil { try container.encode(created, forKey: .created) }
        if updatedBy != nil { try container.encode(updatedBy, forKey: .updatedBy) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if fromTime != nil { try container.encode(fromTime, forKey: .fromTime) }
        if toTime != nil { try container.encode(toTime, forKey: .toTime) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class RebateCodeDayOfWeekRelation : BaseModel
{
    // @Ignore()
    public var dayOfWeek:BokaMeraDayOfWeek

    // @Required()
    public var dayOfWeekId:Int?

    // @Required()
    public var rebateCodeId:Int?

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

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case dayOfWeek
        case dayOfWeekId
        case rebateCodeId
        case companyId
        case id
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dayOfWeek = try container.decodeIfPresent(BokaMeraDayOfWeek.self, forKey: .dayOfWeek)
        dayOfWeekId = try container.decodeIfPresent(Int.self, forKey: .dayOfWeekId)
        rebateCodeId = try container.decodeIfPresent(Int.self, forKey: .rebateCodeId)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

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

public class RebateCodeServiceRelation : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var serviceId:Int?

    // @Required()
    public var rebateCodeId:Int?

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case serviceId
        case rebateCodeId
        case id
        case modifiedDate
    }

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

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

public class RebateCodeBookingPriceRelation : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var priceId:Int?

    // @Required()
    public var rebateCodeId:Int?

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case priceId
        case rebateCodeId
        case id
        case modifiedDate
    }

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

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

public class RebateCodeCustomerRelation : BaseModel
{
    // @Required()
    public var companyId:String?

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

    // @Required()
    public var rebateCodeId:Int?

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case customerId
        case rebateCodeId
        case id
        case modifiedDate
    }

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

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

public class DaysOfWeek : BaseModel
{
    // @Required()
    public var dayOfWeek:String?

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

    public var dayOfWeekActive:Bool?
    public var dayOfWeekSortOrder:Int16?
    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case dayOfWeek
        case dayOfWeekTranslation
        case dayOfWeekActive
        case dayOfWeekSortOrder
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dayOfWeek = try container.decodeIfPresent(String.self, forKey: .dayOfWeek)
        dayOfWeekTranslation = try container.decodeIfPresent(String.self, forKey: .dayOfWeekTranslation)
        dayOfWeekActive = try container.decodeIfPresent(Bool.self, forKey: .dayOfWeekActive)
        dayOfWeekSortOrder = try container.decodeIfPresent(Int16.self, forKey: .dayOfWeekSortOrder)
        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 dayOfWeek != nil { try container.encode(dayOfWeek, forKey: .dayOfWeek) }
        if dayOfWeekTranslation != nil { try container.encode(dayOfWeekTranslation, forKey: .dayOfWeekTranslation) }
        if dayOfWeekActive != nil { try container.encode(dayOfWeekActive, forKey: .dayOfWeekActive) }
        if dayOfWeekSortOrder != nil { try container.encode(dayOfWeekSortOrder, forKey: .dayOfWeekSortOrder) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class Customer : BaseModel, IUser, ICustomFieldTable
{
    public var identityId:Int
    public var id:String
    // @Ignore()
    public var customerId:String

    // @Ignore()
    public var accessKeys:IList<UserAccessKeys>

    public var email:String
    // @Ignore()
    public var externalReferences:IList<ExternalReference>

    // @Ignore()
    public var customFieldsConfig:IList<CustomFieldConfig>

    // @Ignore()
    public var customFieldsData:IList<CustomFieldDataResponse>

    // @Ignore()
    public var comments:IList<CustomerComment>

    public var firstname:String
    // @Ignore()
    public var imageUrl:String

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

    public var facebookUsername:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var ipAddress:String
    public var modifiedDate:Date?
    public var textField1:String
    public var textField2:String
    public var textField3:String
    public var textField4:String
    public var textField5:String
    public var textField6:String
    public var textField7:String
    public var textField8:String
    public var textField9:String
    public var textField10:String
    public var textField11:String
    public var textField12:String
    public var textField13:String
    public var textField14:String
    public var textField15:String
    public var textField16:String
    public var textField17:String
    public var textField18:String
    public var textField19:String
    public var textField20:String
    public var userId:String
    public var lastname:String
    public var phone:String
    public var corporateIdentityNumber:String
    public var invoiceAddress1:String
    public var invoiceAddress2:String
    public var invoiceCity:String
    public var invoicePostalCode:String
    public var invoiceCountryCode:String
    // @Required()
    public var companyId:String?

    public var subscribedToNewsletter:Bool

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

    private enum CodingKeys : String, CodingKey {
        case identityId
        case id
        case customerId
        case accessKeys
        case email
        case externalReferences
        case customFieldsConfig
        case customFieldsData
        case comments
        case firstname
        case imageUrl
        case active
        case facebookUsername
        case updated
        case created
        case ipAddress
        case modifiedDate
        case textField1
        case textField2
        case textField3
        case textField4
        case textField5
        case textField6
        case textField7
        case textField8
        case textField9
        case textField10
        case textField11
        case textField12
        case textField13
        case textField14
        case textField15
        case textField16
        case textField17
        case textField18
        case textField19
        case textField20
        case userId
        case lastname
        case phone
        case corporateIdentityNumber
        case invoiceAddress1
        case invoiceAddress2
        case invoiceCity
        case invoicePostalCode
        case invoiceCountryCode
        case companyId
        case subscribedToNewsletter
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        identityId = try container.decodeIfPresent(Int.self, forKey: .identityId)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
        accessKeys = try container.decodeIfPresent(IList<UserAccessKeys>.self, forKey: .accessKeys)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        externalReferences = try container.decodeIfPresent(IList<ExternalReference>.self, forKey: .externalReferences)
        customFieldsConfig = try container.decodeIfPresent(IList<CustomFieldConfig>.self, forKey: .customFieldsConfig)
        customFieldsData = try container.decodeIfPresent(IList<CustomFieldDataResponse>.self, forKey: .customFieldsData)
        comments = try container.decodeIfPresent(IList<CustomerComment>.self, forKey: .comments)
        firstname = try container.decodeIfPresent(String.self, forKey: .firstname)
        imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        facebookUsername = try container.decodeIfPresent(String.self, forKey: .facebookUsername)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        ipAddress = try container.decodeIfPresent(String.self, forKey: .ipAddress)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        textField1 = try container.decodeIfPresent(String.self, forKey: .textField1)
        textField2 = try container.decodeIfPresent(String.self, forKey: .textField2)
        textField3 = try container.decodeIfPresent(String.self, forKey: .textField3)
        textField4 = try container.decodeIfPresent(String.self, forKey: .textField4)
        textField5 = try container.decodeIfPresent(String.self, forKey: .textField5)
        textField6 = try container.decodeIfPresent(String.self, forKey: .textField6)
        textField7 = try container.decodeIfPresent(String.self, forKey: .textField7)
        textField8 = try container.decodeIfPresent(String.self, forKey: .textField8)
        textField9 = try container.decodeIfPresent(String.self, forKey: .textField9)
        textField10 = try container.decodeIfPresent(String.self, forKey: .textField10)
        textField11 = try container.decodeIfPresent(String.self, forKey: .textField11)
        textField12 = try container.decodeIfPresent(String.self, forKey: .textField12)
        textField13 = try container.decodeIfPresent(String.self, forKey: .textField13)
        textField14 = try container.decodeIfPresent(String.self, forKey: .textField14)
        textField15 = try container.decodeIfPresent(String.self, forKey: .textField15)
        textField16 = try container.decodeIfPresent(String.self, forKey: .textField16)
        textField17 = try container.decodeIfPresent(String.self, forKey: .textField17)
        textField18 = try container.decodeIfPresent(String.self, forKey: .textField18)
        textField19 = try container.decodeIfPresent(String.self, forKey: .textField19)
        textField20 = try container.decodeIfPresent(String.self, forKey: .textField20)
        userId = try container.decodeIfPresent(String.self, forKey: .userId)
        lastname = try container.decodeIfPresent(String.self, forKey: .lastname)
        phone = try container.decodeIfPresent(String.self, forKey: .phone)
        corporateIdentityNumber = try container.decodeIfPresent(String.self, forKey: .corporateIdentityNumber)
        invoiceAddress1 = try container.decodeIfPresent(String.self, forKey: .invoiceAddress1)
        invoiceAddress2 = try container.decodeIfPresent(String.self, forKey: .invoiceAddress2)
        invoiceCity = try container.decodeIfPresent(String.self, forKey: .invoiceCity)
        invoicePostalCode = try container.decodeIfPresent(String.self, forKey: .invoicePostalCode)
        invoiceCountryCode = try container.decodeIfPresent(String.self, forKey: .invoiceCountryCode)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        subscribedToNewsletter = try container.decodeIfPresent(Bool.self, forKey: .subscribedToNewsletter)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if identityId != nil { try container.encode(identityId, forKey: .identityId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if customerId != nil { try container.encode(customerId, forKey: .customerId) }
        if accessKeys != nil { try container.encode(accessKeys, forKey: .accessKeys) }
        if email != nil { try container.encode(email, forKey: .email) }
        if externalReferences != nil { try container.encode(externalReferences, forKey: .externalReferences) }
        if customFieldsConfig != nil { try container.encode(customFieldsConfig, forKey: .customFieldsConfig) }
        if customFieldsData != nil { try container.encode(customFieldsData, forKey: .customFieldsData) }
        if comments != nil { try container.encode(comments, forKey: .comments) }
        if firstname != nil { try container.encode(firstname, forKey: .firstname) }
        if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) }
        if active != nil { try container.encode(active, forKey: .active) }
        if facebookUsername != nil { try container.encode(facebookUsername, forKey: .facebookUsername) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if ipAddress != nil { try container.encode(ipAddress, forKey: .ipAddress) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if textField1 != nil { try container.encode(textField1, forKey: .textField1) }
        if textField2 != nil { try container.encode(textField2, forKey: .textField2) }
        if textField3 != nil { try container.encode(textField3, forKey: .textField3) }
        if textField4 != nil { try container.encode(textField4, forKey: .textField4) }
        if textField5 != nil { try container.encode(textField5, forKey: .textField5) }
        if textField6 != nil { try container.encode(textField6, forKey: .textField6) }
        if textField7 != nil { try container.encode(textField7, forKey: .textField7) }
        if textField8 != nil { try container.encode(textField8, forKey: .textField8) }
        if textField9 != nil { try container.encode(textField9, forKey: .textField9) }
        if textField10 != nil { try container.encode(textField10, forKey: .textField10) }
        if textField11 != nil { try container.encode(textField11, forKey: .textField11) }
        if textField12 != nil { try container.encode(textField12, forKey: .textField12) }
        if textField13 != nil { try container.encode(textField13, forKey: .textField13) }
        if textField14 != nil { try container.encode(textField14, forKey: .textField14) }
        if textField15 != nil { try container.encode(textField15, forKey: .textField15) }
        if textField16 != nil { try container.encode(textField16, forKey: .textField16) }
        if textField17 != nil { try container.encode(textField17, forKey: .textField17) }
        if textField18 != nil { try container.encode(textField18, forKey: .textField18) }
        if textField19 != nil { try container.encode(textField19, forKey: .textField19) }
        if textField20 != nil { try container.encode(textField20, forKey: .textField20) }
        if userId != nil { try container.encode(userId, forKey: .userId) }
        if lastname != nil { try container.encode(lastname, forKey: .lastname) }
        if phone != nil { try container.encode(phone, forKey: .phone) }
        if corporateIdentityNumber != nil { try container.encode(corporateIdentityNumber, forKey: .corporateIdentityNumber) }
        if invoiceAddress1 != nil { try container.encode(invoiceAddress1, forKey: .invoiceAddress1) }
        if invoiceAddress2 != nil { try container.encode(invoiceAddress2, forKey: .invoiceAddress2) }
        if invoiceCity != nil { try container.encode(invoiceCity, forKey: .invoiceCity) }
        if invoicePostalCode != nil { try container.encode(invoicePostalCode, forKey: .invoicePostalCode) }
        if invoiceCountryCode != nil { try container.encode(invoiceCountryCode, forKey: .invoiceCountryCode) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if subscribedToNewsletter != nil { try container.encode(subscribedToNewsletter, forKey: .subscribedToNewsletter) }
    }
}

public class UserAccessKeys : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var accessKeyTypeId:Int?

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

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

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

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case accessKeyTypeId
        case value
        case customerId
        case Description
        case id
    }

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

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

public class ExternalReference : BaseModel
{
    // @Required()
    public var companyId:String?

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

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

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

    public var externalData:String
    public var createdBy:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case ownerId
        case referenceType
        case externalData
        case createdBy
        case updated
        case created
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        ownerId = try container.decodeIfPresent(String.self, forKey: .ownerId)
        referenceType = try container.decodeIfPresent(String.self, forKey: .referenceType)
        externalData = try container.decodeIfPresent(String.self, forKey: .externalData)
        createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if ownerId != nil { try container.encode(ownerId, forKey: .ownerId) }
        if referenceType != nil { try container.encode(referenceType, forKey: .referenceType) }
        if externalData != nil { try container.encode(externalData, forKey: .externalData) }
        if createdBy != nil { try container.encode(createdBy, forKey: .createdBy) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class CustomFieldDataResponse : Codable
{
    public var id:Int
    public var column:String
    public var name:String
    public var Description:String
    public var value:String
    /**
    * Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
    */
    // @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
    public var dataType:String

    required public init(){}
}

public class CustomerComment : BaseModel
{
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var customerId:String?

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

    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var imageUrl:String
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case customerId
        case comments
        case updated
        case created
        case imageUrl
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
        comments = try container.decodeIfPresent(String.self, forKey: .comments)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

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

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

    public var Description:String
    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class BookingStatusOptions : Codable
{
    public var id:Int
    public var name:String
    public var Description:String

    required public init(){}
}

public class BookingSettings : BaseModel
{
    // @References(typeof(FreeSpotTexts))
    public var freeSpotTextsId:Int

    // @Ignore()
    public var sendEmailConfirmation:Bool

    // @Ignore()
    public var scheduleViewOptions:[ScheduleView] = []

    // @Ignore()
    public var weekNumberSettingOptions:[WeekNumberSetting] = []

    // @Ignore()
    public var bookingTemplateOptions:[BookingTemplate] = []

    // @Ignore()
    public var calendarTypeOptions:[CalendarType] = []

    // @Ignore()
    public var freeSpotTextOptions:[FreeSpotTexts] = []

    // @Ignore()
    public var bookingStatusOptions:[BookingStatusOptions] = []

    public var freeSpotTextsInfo:FreeSpotTexts
    // @Ignore()
    public var freeSpotsTextSingular:String

    // @Ignore()
    public var freeSpotsTextPlural:String

    // @Required()
    public var bookingStatusId:Int?

    // @Required()
    public var scheduleViewId:Int?

    // @Required()
    public var bookingTemplateId:Int?

    // @Required()
    public var calendarTypeId:Int?

    // @Required()
    public var allowBookingOnUnbookedTimes:Bool?

    // @Required()
    public var sendEmailReminder:Bool?

    // @Required()
    public var sendSmsReminder:Bool?

    // @Required()
    public var sendSmsConfirmation:Bool?

    // @Required()
    public var emailReminderTime:Int?

    // @Required()
    public var smsReminderTime:Int?

    // @Required()
    public var maxActiveBookings:Int?

    // @Required()
    public var sendNotifications:Bool?

    public var sendNotificationsEmail:String
    // @Required()
    public var enableMobileApp:Bool?

    @TimeSpan public var scheduleStartTime:TimeInterval?
    @TimeSpan public var scheduleEndTime:TimeInterval?
    public var receiptTemplate:String
    // @Required()
    public var scheduleTimeSlotMinutes:Int?

    // @Required()
    public var showFreeTimesLeft:Bool?

    // @Required()
    public var enableICalGroupBookings:Bool?

    public var agreementTemplate:String
    // @Required()
    public var scheduleShowTimeExeptions:Bool?

    // @Required()
    public var enableBookingsOnSameTime:Bool?

    // @Required()
    public var showWeekNumberSettingId:Int?

    // @Required()
    public var enableShowBookedTimes:Bool?

    // @Required()
    public var enableSendFollowUpMessage:Bool?

    // @Required()
    public var followUpMessageTime:Int?

    public var messageText:String
    // @Required()
    public var scheduleGroupResources:Bool?

    // @Required()
    public var bookSpotUserResponseMinutes:Int?

    // @Required()
    public var isBookSpotDirectly:Bool?

    // @Required()
    public var bookSpotDirectlyTimeLeftMinutes:Int?

    // @Required()
    public var sendEmailNotificationQueue:Bool?

    // @Required()
    public var sendSMSNotificationQueue:Bool?

    // @Required()
    public var schedulerDisableHorizontalScrolling:Bool?

    // @Required()
    public var bookOnlyOnExistingCustomers:Bool?

    // @Required()
    public var autoGenerateUniquePinCode:Bool?

    // @Required()
    public var weightedPrices:Bool?

    public var modifiedDate:Date?
    // @Required()
    public var autoCreateUserProfile:Bool?

    public var showMultipleResourcesAsOne:Bool
    public var showMultiDayAsTime:Bool
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case freeSpotTextsId
        case sendEmailConfirmation
        case scheduleViewOptions
        case weekNumberSettingOptions
        case bookingTemplateOptions
        case calendarTypeOptions
        case freeSpotTextOptions
        case bookingStatusOptions
        case freeSpotTextsInfo
        case freeSpotsTextSingular
        case freeSpotsTextPlural
        case bookingStatusId
        case scheduleViewId
        case bookingTemplateId
        case calendarTypeId
        case allowBookingOnUnbookedTimes
        case sendEmailReminder
        case sendSmsReminder
        case sendSmsConfirmation
        case emailReminderTime
        case smsReminderTime
        case maxActiveBookings
        case sendNotifications
        case sendNotificationsEmail
        case enableMobileApp
        case scheduleStartTime
        case scheduleEndTime
        case receiptTemplate
        case scheduleTimeSlotMinutes
        case showFreeTimesLeft
        case enableICalGroupBookings
        case agreementTemplate
        case scheduleShowTimeExeptions
        case enableBookingsOnSameTime
        case showWeekNumberSettingId
        case enableShowBookedTimes
        case enableSendFollowUpMessage
        case followUpMessageTime
        case messageText
        case scheduleGroupResources
        case bookSpotUserResponseMinutes
        case isBookSpotDirectly
        case bookSpotDirectlyTimeLeftMinutes
        case sendEmailNotificationQueue
        case sendSMSNotificationQueue
        case schedulerDisableHorizontalScrolling
        case bookOnlyOnExistingCustomers
        case autoGenerateUniquePinCode
        case weightedPrices
        case modifiedDate
        case autoCreateUserProfile
        case showMultipleResourcesAsOne
        case showMultiDayAsTime
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        freeSpotTextsId = try container.decodeIfPresent(Int.self, forKey: .freeSpotTextsId)
        sendEmailConfirmation = try container.decodeIfPresent(Bool.self, forKey: .sendEmailConfirmation)
        scheduleViewOptions = try container.decodeIfPresent([ScheduleView].self, forKey: .scheduleViewOptions) ?? []
        weekNumberSettingOptions = try container.decodeIfPresent([WeekNumberSetting].self, forKey: .weekNumberSettingOptions) ?? []
        bookingTemplateOptions = try container.decodeIfPresent([BookingTemplate].self, forKey: .bookingTemplateOptions) ?? []
        calendarTypeOptions = try container.decodeIfPresent([CalendarType].self, forKey: .calendarTypeOptions) ?? []
        freeSpotTextOptions = try container.decodeIfPresent([FreeSpotTexts].self, forKey: .freeSpotTextOptions) ?? []
        bookingStatusOptions = try container.decodeIfPresent([BookingStatusOptions].self, forKey: .bookingStatusOptions) ?? []
        freeSpotTextsInfo = try container.decodeIfPresent(FreeSpotTexts.self, forKey: .freeSpotTextsInfo)
        freeSpotsTextSingular = try container.decodeIfPresent(String.self, forKey: .freeSpotsTextSingular)
        freeSpotsTextPlural = try container.decodeIfPresent(String.self, forKey: .freeSpotsTextPlural)
        bookingStatusId = try container.decodeIfPresent(Int.self, forKey: .bookingStatusId)
        scheduleViewId = try container.decodeIfPresent(Int.self, forKey: .scheduleViewId)
        bookingTemplateId = try container.decodeIfPresent(Int.self, forKey: .bookingTemplateId)
        calendarTypeId = try container.decodeIfPresent(Int.self, forKey: .calendarTypeId)
        allowBookingOnUnbookedTimes = try container.decodeIfPresent(Bool.self, forKey: .allowBookingOnUnbookedTimes)
        sendEmailReminder = try container.decodeIfPresent(Bool.self, forKey: .sendEmailReminder)
        sendSmsReminder = try container.decodeIfPresent(Bool.self, forKey: .sendSmsReminder)
        sendSmsConfirmation = try container.decodeIfPresent(Bool.self, forKey: .sendSmsConfirmation)
        emailReminderTime = try container.decodeIfPresent(Int.self, forKey: .emailReminderTime)
        smsReminderTime = try container.decodeIfPresent(Int.self, forKey: .smsReminderTime)
        maxActiveBookings = try container.decodeIfPresent(Int.self, forKey: .maxActiveBookings)
        sendNotifications = try container.decodeIfPresent(Bool.self, forKey: .sendNotifications)
        sendNotificationsEmail = try container.decodeIfPresent(String.self, forKey: .sendNotificationsEmail)
        enableMobileApp = try container.decodeIfPresent(Bool.self, forKey: .enableMobileApp)
        scheduleStartTime = try container.convertIfPresent(TimeInterval.self, forKey: .scheduleStartTime)
        scheduleEndTime = try container.convertIfPresent(TimeInterval.self, forKey: .scheduleEndTime)
        receiptTemplate = try container.decodeIfPresent(String.self, forKey: .receiptTemplate)
        scheduleTimeSlotMinutes = try container.decodeIfPresent(Int.self, forKey: .scheduleTimeSlotMinutes)
        showFreeTimesLeft = try container.decodeIfPresent(Bool.self, forKey: .showFreeTimesLeft)
        enableICalGroupBookings = try container.decodeIfPresent(Bool.self, forKey: .enableICalGroupBookings)
        agreementTemplate = try container.decodeIfPresent(String.self, forKey: .agreementTemplate)
        scheduleShowTimeExeptions = try container.decodeIfPresent(Bool.self, forKey: .scheduleShowTimeExeptions)
        enableBookingsOnSameTime = try container.decodeIfPresent(Bool.self, forKey: .enableBookingsOnSameTime)
        showWeekNumberSettingId = try container.decodeIfPresent(Int.self, forKey: .showWeekNumberSettingId)
        enableShowBookedTimes = try container.decodeIfPresent(Bool.self, forKey: .enableShowBookedTimes)
        enableSendFollowUpMessage = try container.decodeIfPresent(Bool.self, forKey: .enableSendFollowUpMessage)
        followUpMessageTime = try container.decodeIfPresent(Int.self, forKey: .followUpMessageTime)
        messageText = try container.decodeIfPresent(String.self, forKey: .messageText)
        scheduleGroupResources = try container.decodeIfPresent(Bool.self, forKey: .scheduleGroupResources)
        bookSpotUserResponseMinutes = try container.decodeIfPresent(Int.self, forKey: .bookSpotUserResponseMinutes)
        isBookSpotDirectly = try container.decodeIfPresent(Bool.self, forKey: .isBookSpotDirectly)
        bookSpotDirectlyTimeLeftMinutes = try container.decodeIfPresent(Int.self, forKey: .bookSpotDirectlyTimeLeftMinutes)
        sendEmailNotificationQueue = try container.decodeIfPresent(Bool.self, forKey: .sendEmailNotificationQueue)
        sendSMSNotificationQueue = try container.decodeIfPresent(Bool.self, forKey: .sendSMSNotificationQueue)
        schedulerDisableHorizontalScrolling = try container.decodeIfPresent(Bool.self, forKey: .schedulerDisableHorizontalScrolling)
        bookOnlyOnExistingCustomers = try container.decodeIfPresent(Bool.self, forKey: .bookOnlyOnExistingCustomers)
        autoGenerateUniquePinCode = try container.decodeIfPresent(Bool.self, forKey: .autoGenerateUniquePinCode)
        weightedPrices = try container.decodeIfPresent(Bool.self, forKey: .weightedPrices)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        autoCreateUserProfile = try container.decodeIfPresent(Bool.self, forKey: .autoCreateUserProfile)
        showMultipleResourcesAsOne = try container.decodeIfPresent(Bool.self, forKey: .showMultipleResourcesAsOne)
        showMultiDayAsTime = try container.decodeIfPresent(Bool.self, forKey: .showMultiDayAsTime)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if freeSpotTextsId != nil { try container.encode(freeSpotTextsId, forKey: .freeSpotTextsId) }
        if sendEmailConfirmation != nil { try container.encode(sendEmailConfirmation, forKey: .sendEmailConfirmation) }
        if scheduleViewOptions.count > 0 { try container.encode(scheduleViewOptions, forKey: .scheduleViewOptions) }
        if weekNumberSettingOptions.count > 0 { try container.encode(weekNumberSettingOptions, forKey: .weekNumberSettingOptions) }
        if bookingTemplateOptions.count > 0 { try container.encode(bookingTemplateOptions, forKey: .bookingTemplateOptions) }
        if calendarTypeOptions.count > 0 { try container.encode(calendarTypeOptions, forKey: .calendarTypeOptions) }
        if freeSpotTextOptions.count > 0 { try container.encode(freeSpotTextOptions, forKey: .freeSpotTextOptions) }
        if bookingStatusOptions.count > 0 { try container.encode(bookingStatusOptions, forKey: .bookingStatusOptions) }
        if freeSpotTextsInfo != nil { try container.encode(freeSpotTextsInfo, forKey: .freeSpotTextsInfo) }
        if freeSpotsTextSingular != nil { try container.encode(freeSpotsTextSingular, forKey: .freeSpotsTextSingular) }
        if freeSpotsTextPlural != nil { try container.encode(freeSpotsTextPlural, forKey: .freeSpotsTextPlural) }
        if bookingStatusId != nil { try container.encode(bookingStatusId, forKey: .bookingStatusId) }
        if scheduleViewId != nil { try container.encode(scheduleViewId, forKey: .scheduleViewId) }
        if bookingTemplateId != nil { try container.encode(bookingTemplateId, forKey: .bookingTemplateId) }
        if calendarTypeId != nil { try container.encode(calendarTypeId, forKey: .calendarTypeId) }
        if allowBookingOnUnbookedTimes != nil { try container.encode(allowBookingOnUnbookedTimes, forKey: .allowBookingOnUnbookedTimes) }
        if sendEmailReminder != nil { try container.encode(sendEmailReminder, forKey: .sendEmailReminder) }
        if sendSmsReminder != nil { try container.encode(sendSmsReminder, forKey: .sendSmsReminder) }
        if sendSmsConfirmation != nil { try container.encode(sendSmsConfirmation, forKey: .sendSmsConfirmation) }
        if emailReminderTime != nil { try container.encode(emailReminderTime, forKey: .emailReminderTime) }
        if smsReminderTime != nil { try container.encode(smsReminderTime, forKey: .smsReminderTime) }
        if maxActiveBookings != nil { try container.encode(maxActiveBookings, forKey: .maxActiveBookings) }
        if sendNotifications != nil { try container.encode(sendNotifications, forKey: .sendNotifications) }
        if sendNotificationsEmail != nil { try container.encode(sendNotificationsEmail, forKey: .sendNotificationsEmail) }
        if enableMobileApp != nil { try container.encode(enableMobileApp, forKey: .enableMobileApp) }
        if scheduleStartTime != nil { try container.encode(scheduleStartTime, forKey: .scheduleStartTime) }
        if scheduleEndTime != nil { try container.encode(scheduleEndTime, forKey: .scheduleEndTime) }
        if receiptTemplate != nil { try container.encode(receiptTemplate, forKey: .receiptTemplate) }
        if scheduleTimeSlotMinutes != nil { try container.encode(scheduleTimeSlotMinutes, forKey: .scheduleTimeSlotMinutes) }
        if showFreeTimesLeft != nil { try container.encode(showFreeTimesLeft, forKey: .showFreeTimesLeft) }
        if enableICalGroupBookings != nil { try container.encode(enableICalGroupBookings, forKey: .enableICalGroupBookings) }
        if agreementTemplate != nil { try container.encode(agreementTemplate, forKey: .agreementTemplate) }
        if scheduleShowTimeExeptions != nil { try container.encode(scheduleShowTimeExeptions, forKey: .scheduleShowTimeExeptions) }
        if enableBookingsOnSameTime != nil { try container.encode(enableBookingsOnSameTime, forKey: .enableBookingsOnSameTime) }
        if showWeekNumberSettingId != nil { try container.encode(showWeekNumberSettingId, forKey: .showWeekNumberSettingId) }
        if enableShowBookedTimes != nil { try container.encode(enableShowBookedTimes, forKey: .enableShowBookedTimes) }
        if enableSendFollowUpMessage != nil { try container.encode(enableSendFollowUpMessage, forKey: .enableSendFollowUpMessage) }
        if followUpMessageTime != nil { try container.encode(followUpMessageTime, forKey: .followUpMessageTime) }
        if messageText != nil { try container.encode(messageText, forKey: .messageText) }
        if scheduleGroupResources != nil { try container.encode(scheduleGroupResources, forKey: .scheduleGroupResources) }
        if bookSpotUserResponseMinutes != nil { try container.encode(bookSpotUserResponseMinutes, forKey: .bookSpotUserResponseMinutes) }
        if isBookSpotDirectly != nil { try container.encode(isBookSpotDirectly, forKey: .isBookSpotDirectly) }
        if bookSpotDirectlyTimeLeftMinutes != nil { try container.encode(bookSpotDirectlyTimeLeftMinutes, forKey: .bookSpotDirectlyTimeLeftMinutes) }
        if sendEmailNotificationQueue != nil { try container.encode(sendEmailNotificationQueue, forKey: .sendEmailNotificationQueue) }
        if sendSMSNotificationQueue != nil { try container.encode(sendSMSNotificationQueue, forKey: .sendSMSNotificationQueue) }
        if schedulerDisableHorizontalScrolling != nil { try container.encode(schedulerDisableHorizontalScrolling, forKey: .schedulerDisableHorizontalScrolling) }
        if bookOnlyOnExistingCustomers != nil { try container.encode(bookOnlyOnExistingCustomers, forKey: .bookOnlyOnExistingCustomers) }
        if autoGenerateUniquePinCode != nil { try container.encode(autoGenerateUniquePinCode, forKey: .autoGenerateUniquePinCode) }
        if weightedPrices != nil { try container.encode(weightedPrices, forKey: .weightedPrices) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if autoCreateUserProfile != nil { try container.encode(autoCreateUserProfile, forKey: .autoCreateUserProfile) }
        if showMultipleResourcesAsOne != nil { try container.encode(showMultipleResourcesAsOne, forKey: .showMultipleResourcesAsOne) }
        if showMultiDayAsTime != nil { try container.encode(showMultiDayAsTime, forKey: .showMultiDayAsTime) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        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)
        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 modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case usedByApplication
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        usedByApplication = try container.decodeIfPresent(String.self, forKey: .usedByApplication)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if usedByApplication != nil { try container.encode(usedByApplication, forKey: .usedByApplication) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case active
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if active != nil { try container.encode(active, forKey: .active) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class FreeSpotTexts : BaseModel
{
    // @Required()
    public var textSingular:String?

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case textSingular
        case textPlural
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        textSingular = try container.decodeIfPresent(String.self, forKey: .textSingular)
        textPlural = try container.decodeIfPresent(String.self, forKey: .textPlural)
        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 textSingular != nil { try container.encode(textSingular, forKey: .textSingular) }
        if textPlural != nil { try container.encode(textPlural, forKey: .textPlural) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class PaymentSetting : BaseModel
{
    public var adminPaymentOption:AdminPaymentOptions
    // @Ignore()
    public var adminPaymentOptions:[AdminPaymentOptions] = []

    // @Ignore()
    public var paymentProviderOptions:[PaymentProviders] = []

    // @Required()
    public var enabled:Bool?

    // @Required()
    public var invoiceFee:Int?

    // @Required()
    public var allowCreditCardPayment:Bool?

    // @Required()
    public var allowInvoicePayment:Bool?

    // @Required()
    public var allowBankPayment:Bool?

    // @Required()
    public var guaranteeOffered:Bool?

    // @Required()
    public var refundOnCancelBooking:Bool?

    public var defaultPaymentOptionId:Int?
    // @Required()
    public var paymentProviderId:Int?

    // @Required()
    public var sendPaymentRequestDirectly:Bool?

    public var modifiedDate:Date?
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case adminPaymentOption
        case adminPaymentOptions
        case paymentProviderOptions
        case enabled
        case invoiceFee
        case allowCreditCardPayment
        case allowInvoicePayment
        case allowBankPayment
        case guaranteeOffered
        case refundOnCancelBooking
        case defaultPaymentOptionId
        case paymentProviderId
        case sendPaymentRequestDirectly
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        adminPaymentOption = try container.decodeIfPresent(AdminPaymentOptions.self, forKey: .adminPaymentOption)
        adminPaymentOptions = try container.decodeIfPresent([AdminPaymentOptions].self, forKey: .adminPaymentOptions) ?? []
        paymentProviderOptions = try container.decodeIfPresent([PaymentProviders].self, forKey: .paymentProviderOptions) ?? []
        enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled)
        invoiceFee = try container.decodeIfPresent(Int.self, forKey: .invoiceFee)
        allowCreditCardPayment = try container.decodeIfPresent(Bool.self, forKey: .allowCreditCardPayment)
        allowInvoicePayment = try container.decodeIfPresent(Bool.self, forKey: .allowInvoicePayment)
        allowBankPayment = try container.decodeIfPresent(Bool.self, forKey: .allowBankPayment)
        guaranteeOffered = try container.decodeIfPresent(Bool.self, forKey: .guaranteeOffered)
        refundOnCancelBooking = try container.decodeIfPresent(Bool.self, forKey: .refundOnCancelBooking)
        defaultPaymentOptionId = try container.decodeIfPresent(Int.self, forKey: .defaultPaymentOptionId)
        paymentProviderId = try container.decodeIfPresent(Int.self, forKey: .paymentProviderId)
        sendPaymentRequestDirectly = try container.decodeIfPresent(Bool.self, forKey: .sendPaymentRequestDirectly)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if adminPaymentOption != nil { try container.encode(adminPaymentOption, forKey: .adminPaymentOption) }
        if adminPaymentOptions.count > 0 { try container.encode(adminPaymentOptions, forKey: .adminPaymentOptions) }
        if paymentProviderOptions.count > 0 { try container.encode(paymentProviderOptions, forKey: .paymentProviderOptions) }
        if enabled != nil { try container.encode(enabled, forKey: .enabled) }
        if invoiceFee != nil { try container.encode(invoiceFee, forKey: .invoiceFee) }
        if allowCreditCardPayment != nil { try container.encode(allowCreditCardPayment, forKey: .allowCreditCardPayment) }
        if allowInvoicePayment != nil { try container.encode(allowInvoicePayment, forKey: .allowInvoicePayment) }
        if allowBankPayment != nil { try container.encode(allowBankPayment, forKey: .allowBankPayment) }
        if guaranteeOffered != nil { try container.encode(guaranteeOffered, forKey: .guaranteeOffered) }
        if refundOnCancelBooking != nil { try container.encode(refundOnCancelBooking, forKey: .refundOnCancelBooking) }
        if defaultPaymentOptionId != nil { try container.encode(defaultPaymentOptionId, forKey: .defaultPaymentOptionId) }
        if paymentProviderId != nil { try container.encode(paymentProviderId, forKey: .paymentProviderId) }
        if sendPaymentRequestDirectly != nil { try container.encode(sendPaymentRequestDirectly, forKey: .sendPaymentRequestDirectly) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var url:String
    // @Required()
    public var active:Bool?

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case category
        case url
        case active
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        category = try container.decodeIfPresent(String.self, forKey: .category)
        url = try container.decodeIfPresent(String.self, forKey: .url)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if category != nil { try container.encode(category, forKey: .category) }
        if url != nil { try container.encode(url, forKey: .url) }
        if active != nil { try container.encode(active, forKey: .active) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class Booking : BaseModel, IInterval, ICustomFieldTable, IBaseModelUpdated, IBaseModelCreated
{
    // @Ignore()
    public var customer:Customer

    // @Ignore()
    public var service:Service

    // @Ignore()
    public var calendarExport:CalendarExport

    // @Ignore()
    public var log:[BookingLog] = []

    // @Ignore()
    public var paymentLog:[PaymentLog] = []

    // @Ignore()
    public var checkoutLogs:[PaymentDetails] = []

    // @Ignore()
    public var prices:[BookingPrice] = []

    // @Ignore()
    public var status:BookingStatusEnum

    // @Ignore()
    public var isReserved:Bool

    // @Ignore()
    public var statusName:String

    // @Ignore()
    public var company:Company

    // @References(typeof(Currency))
    public var currencyId:String

    public var currencyInfo:Currency
    public var bookingStatus:BookingStatus
    // @Ignore()
    public var totalPrice:Double?

    // @Ignore()
    public var totalSpots:Int?

    // @Ignore()
    public var resources:IList<Resource>

    // @Ignore()
    public var externalReferences:IList<ExternalReference>

    // @Ignore()
    public var bookedResources:IList<BookedResourceType>

    // @Ignore()
    public var customFieldsConfig:IList<CustomFieldConfig>

    // @Ignore()
    public var customFieldsData:IList<CustomFieldDataResponse>

    // @Ignore()
    public var active:Bool

    // @Ignore()
    public var lastTimeToUnBook:Date?

    // @Ignore()
    public var priceMappings:[PriceMapping] = []

    // @Required()
    public var updatedDate:Date?

    // @Required()
    public var createdDate:Date?

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

    public var id:Int
    // @Required()
    public var customerId:String?

    // @Required()
    public var serviceId:Int?

    // @Required()
    public var statusId:Int?

    public var unbookedOn:Date?
    public var unbookedComments:String
    public var bookedComments:String
    // @Required()
    public var bookedBy:String?

    public var unBookedBy:String
    // @Required()
    public var sendSmsReminder:Bool?

    // @Required()
    public var sendEmailReminder:Bool?

    // @Required()
    public var sendSmsConfirmation:Bool?

    public var rebateCode:String
    public var comments:String
    public var ipAddress:String
    // @Required()
    public var numberOfBookedSpots:Int?

    public var commentsToCustomer:String
    public var paymentExpiration:Date?
    public var priceVat:Double?
    // @Required()
    public var sendEmailConfirmation:Bool?

    public var cancellationCode:String
    public var modifiedDate:Date?
    public var ratingCode:String
    public var textField1:String
    public var textField2:String
    public var textField3:String
    public var textField4:String
    public var textField5:String
    public var textField6:String
    public var textField7:String
    public var textField8:String
    public var textField9:String
    public var textField10:String
    public var textField11:String
    public var textField12:String
    public var textField13:String
    public var textField14:String
    public var textField15:String
    public var textField16:String
    public var textField17:String
    public var textField18:String
    public var textField19:String
    public var textField20:String
    // @Required()
    public var from:Date?

    // @Required()
    public var to:Date?

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

    private enum CodingKeys : String, CodingKey {
        case customer
        case service
        case calendarExport
        case log
        case paymentLog
        case checkoutLogs
        case prices
        case status
        case isReserved
        case statusName
        case company
        case currencyId
        case currencyInfo
        case bookingStatus
        case totalPrice
        case totalSpots
        case resources
        case externalReferences
        case bookedResources
        case customFieldsConfig
        case customFieldsData
        case active
        case lastTimeToUnBook
        case priceMappings
        case updatedDate
        case createdDate
        case companyId
        case id
        case customerId
        case serviceId
        case statusId
        case unbookedOn
        case unbookedComments
        case bookedComments
        case bookedBy
        case unBookedBy
        case sendSmsReminder
        case sendEmailReminder
        case sendSmsConfirmation
        case rebateCode
        case comments
        case ipAddress
        case numberOfBookedSpots
        case commentsToCustomer
        case paymentExpiration
        case priceVat
        case sendEmailConfirmation
        case cancellationCode
        case modifiedDate
        case ratingCode
        case textField1
        case textField2
        case textField3
        case textField4
        case textField5
        case textField6
        case textField7
        case textField8
        case textField9
        case textField10
        case textField11
        case textField12
        case textField13
        case textField14
        case textField15
        case textField16
        case textField17
        case textField18
        case textField19
        case textField20
        case from
        case to
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        customer = try container.decodeIfPresent(Customer.self, forKey: .customer)
        service = try container.decodeIfPresent(Service.self, forKey: .service)
        calendarExport = try container.decodeIfPresent(CalendarExport.self, forKey: .calendarExport)
        log = try container.decodeIfPresent([BookingLog].self, forKey: .log) ?? []
        paymentLog = try container.decodeIfPresent([PaymentLog].self, forKey: .paymentLog) ?? []
        checkoutLogs = try container.decodeIfPresent([PaymentDetails].self, forKey: .checkoutLogs) ?? []
        prices = try container.decodeIfPresent([BookingPrice].self, forKey: .prices) ?? []
        status = try container.decodeIfPresent(BookingStatusEnum.self, forKey: .status)
        isReserved = try container.decodeIfPresent(Bool.self, forKey: .isReserved)
        statusName = try container.decodeIfPresent(String.self, forKey: .statusName)
        company = try container.decodeIfPresent(Company.self, forKey: .company)
        currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
        currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
        bookingStatus = try container.decodeIfPresent(BookingStatus.self, forKey: .bookingStatus)
        totalPrice = try container.decodeIfPresent(Double.self, forKey: .totalPrice)
        totalSpots = try container.decodeIfPresent(Int.self, forKey: .totalSpots)
        resources = try container.decodeIfPresent(IList<Resource>.self, forKey: .resources)
        externalReferences = try container.decodeIfPresent(IList<ExternalReference>.self, forKey: .externalReferences)
        bookedResources = try container.decodeIfPresent(IList<BookedResourceType>.self, forKey: .bookedResources)
        customFieldsConfig = try container.decodeIfPresent(IList<CustomFieldConfig>.self, forKey: .customFieldsConfig)
        customFieldsData = try container.decodeIfPresent(IList<CustomFieldDataResponse>.self, forKey: .customFieldsData)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        lastTimeToUnBook = try container.decodeIfPresent(Date.self, forKey: .lastTimeToUnBook)
        priceMappings = try container.decodeIfPresent([PriceMapping].self, forKey: .priceMappings) ?? []
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
        serviceId = try container.decodeIfPresent(Int.self, forKey: .serviceId)
        statusId = try container.decodeIfPresent(Int.self, forKey: .statusId)
        unbookedOn = try container.decodeIfPresent(Date.self, forKey: .unbookedOn)
        unbookedComments = try container.decodeIfPresent(String.self, forKey: .unbookedComments)
        bookedComments = try container.decodeIfPresent(String.self, forKey: .bookedComments)
        bookedBy = try container.decodeIfPresent(String.self, forKey: .bookedBy)
        unBookedBy = try container.decodeIfPresent(String.self, forKey: .unBookedBy)
        sendSmsReminder = try container.decodeIfPresent(Bool.self, forKey: .sendSmsReminder)
        sendEmailReminder = try container.decodeIfPresent(Bool.self, forKey: .sendEmailReminder)
        sendSmsConfirmation = try container.decodeIfPresent(Bool.self, forKey: .sendSmsConfirmation)
        rebateCode = try container.decodeIfPresent(String.self, forKey: .rebateCode)
        comments = try container.decodeIfPresent(String.self, forKey: .comments)
        ipAddress = try container.decodeIfPresent(String.self, forKey: .ipAddress)
        numberOfBookedSpots = try container.decodeIfPresent(Int.self, forKey: .numberOfBookedSpots)
        commentsToCustomer = try container.decodeIfPresent(String.self, forKey: .commentsToCustomer)
        paymentExpiration = try container.decodeIfPresent(Date.self, forKey: .paymentExpiration)
        priceVat = try container.decodeIfPresent(Double.self, forKey: .priceVat)
        sendEmailConfirmation = try container.decodeIfPresent(Bool.self, forKey: .sendEmailConfirmation)
        cancellationCode = try container.decodeIfPresent(String.self, forKey: .cancellationCode)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        ratingCode = try container.decodeIfPresent(String.self, forKey: .ratingCode)
        textField1 = try container.decodeIfPresent(String.self, forKey: .textField1)
        textField2 = try container.decodeIfPresent(String.self, forKey: .textField2)
        textField3 = try container.decodeIfPresent(String.self, forKey: .textField3)
        textField4 = try container.decodeIfPresent(String.self, forKey: .textField4)
        textField5 = try container.decodeIfPresent(String.self, forKey: .textField5)
        textField6 = try container.decodeIfPresent(String.self, forKey: .textField6)
        textField7 = try container.decodeIfPresent(String.self, forKey: .textField7)
        textField8 = try container.decodeIfPresent(String.self, forKey: .textField8)
        textField9 = try container.decodeIfPresent(String.self, forKey: .textField9)
        textField10 = try container.decodeIfPresent(String.self, forKey: .textField10)
        textField11 = try container.decodeIfPresent(String.self, forKey: .textField11)
        textField12 = try container.decodeIfPresent(String.self, forKey: .textField12)
        textField13 = try container.decodeIfPresent(String.self, forKey: .textField13)
        textField14 = try container.decodeIfPresent(String.self, forKey: .textField14)
        textField15 = try container.decodeIfPresent(String.self, forKey: .textField15)
        textField16 = try container.decodeIfPresent(String.self, forKey: .textField16)
        textField17 = try container.decodeIfPresent(String.self, forKey: .textField17)
        textField18 = try container.decodeIfPresent(String.self, forKey: .textField18)
        textField19 = try container.decodeIfPresent(String.self, forKey: .textField19)
        textField20 = try container.decodeIfPresent(String.self, forKey: .textField20)
        from = try container.decodeIfPresent(Date.self, forKey: .from)
        to = try container.decodeIfPresent(Date.self, forKey: .to)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if customer != nil { try container.encode(customer, forKey: .customer) }
        if service != nil { try container.encode(service, forKey: .service) }
        if calendarExport != nil { try container.encode(calendarExport, forKey: .calendarExport) }
        if log.count > 0 { try container.encode(log, forKey: .log) }
        if paymentLog.count > 0 { try container.encode(paymentLog, forKey: .paymentLog) }
        if checkoutLogs.count > 0 { try container.encode(checkoutLogs, forKey: .checkoutLogs) }
        if prices.count > 0 { try container.encode(prices, forKey: .prices) }
        if status != nil { try container.encode(status, forKey: .status) }
        if isReserved != nil { try container.encode(isReserved, forKey: .isReserved) }
        if statusName != nil { try container.encode(statusName, forKey: .statusName) }
        if company != nil { try container.encode(company, forKey: .company) }
        if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
        if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
        if bookingStatus != nil { try container.encode(bookingStatus, forKey: .bookingStatus) }
        if totalPrice != nil { try container.encode(totalPrice, forKey: .totalPrice) }
        if totalSpots != nil { try container.encode(totalSpots, forKey: .totalSpots) }
        if resources != nil { try container.encode(resources, forKey: .resources) }
        if externalReferences != nil { try container.encode(externalReferences, forKey: .externalReferences) }
        if bookedResources != nil { try container.encode(bookedResources, forKey: .bookedResources) }
        if customFieldsConfig != nil { try container.encode(customFieldsConfig, forKey: .customFieldsConfig) }
        if customFieldsData != nil { try container.encode(customFieldsData, forKey: .customFieldsData) }
        if active != nil { try container.encode(active, forKey: .active) }
        if lastTimeToUnBook != nil { try container.encode(lastTimeToUnBook, forKey: .lastTimeToUnBook) }
        if priceMappings.count > 0 { try container.encode(priceMappings, forKey: .priceMappings) }
        if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
        if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if customerId != nil { try container.encode(customerId, forKey: .customerId) }
        if serviceId != nil { try container.encode(serviceId, forKey: .serviceId) }
        if statusId != nil { try container.encode(statusId, forKey: .statusId) }
        if unbookedOn != nil { try container.encode(unbookedOn, forKey: .unbookedOn) }
        if unbookedComments != nil { try container.encode(unbookedComments, forKey: .unbookedComments) }
        if bookedComments != nil { try container.encode(bookedComments, forKey: .bookedComments) }
        if bookedBy != nil { try container.encode(bookedBy, forKey: .bookedBy) }
        if unBookedBy != nil { try container.encode(unBookedBy, forKey: .unBookedBy) }
        if sendSmsReminder != nil { try container.encode(sendSmsReminder, forKey: .sendSmsReminder) }
        if sendEmailReminder != nil { try container.encode(sendEmailReminder, forKey: .sendEmailReminder) }
        if sendSmsConfirmation != nil { try container.encode(sendSmsConfirmation, forKey: .sendSmsConfirmation) }
        if rebateCode != nil { try container.encode(rebateCode, forKey: .rebateCode) }
        if comments != nil { try container.encode(comments, forKey: .comments) }
        if ipAddress != nil { try container.encode(ipAddress, forKey: .ipAddress) }
        if numberOfBookedSpots != nil { try container.encode(numberOfBookedSpots, forKey: .numberOfBookedSpots) }
        if commentsToCustomer != nil { try container.encode(commentsToCustomer, forKey: .commentsToCustomer) }
        if paymentExpiration != nil { try container.encode(paymentExpiration, forKey: .paymentExpiration) }
        if priceVat != nil { try container.encode(priceVat, forKey: .priceVat) }
        if sendEmailConfirmation != nil { try container.encode(sendEmailConfirmation, forKey: .sendEmailConfirmation) }
        if cancellationCode != nil { try container.encode(cancellationCode, forKey: .cancellationCode) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if ratingCode != nil { try container.encode(ratingCode, forKey: .ratingCode) }
        if textField1 != nil { try container.encode(textField1, forKey: .textField1) }
        if textField2 != nil { try container.encode(textField2, forKey: .textField2) }
        if textField3 != nil { try container.encode(textField3, forKey: .textField3) }
        if textField4 != nil { try container.encode(textField4, forKey: .textField4) }
        if textField5 != nil { try container.encode(textField5, forKey: .textField5) }
        if textField6 != nil { try container.encode(textField6, forKey: .textField6) }
        if textField7 != nil { try container.encode(textField7, forKey: .textField7) }
        if textField8 != nil { try container.encode(textField8, forKey: .textField8) }
        if textField9 != nil { try container.encode(textField9, forKey: .textField9) }
        if textField10 != nil { try container.encode(textField10, forKey: .textField10) }
        if textField11 != nil { try container.encode(textField11, forKey: .textField11) }
        if textField12 != nil { try container.encode(textField12, forKey: .textField12) }
        if textField13 != nil { try container.encode(textField13, forKey: .textField13) }
        if textField14 != nil { try container.encode(textField14, forKey: .textField14) }
        if textField15 != nil { try container.encode(textField15, forKey: .textField15) }
        if textField16 != nil { try container.encode(textField16, forKey: .textField16) }
        if textField17 != nil { try container.encode(textField17, forKey: .textField17) }
        if textField18 != nil { try container.encode(textField18, forKey: .textField18) }
        if textField19 != nil { try container.encode(textField19, forKey: .textField19) }
        if textField20 != nil { try container.encode(textField20, forKey: .textField20) }
        if from != nil { try container.encode(from, forKey: .from) }
        if to != nil { try container.encode(to, forKey: .to) }
    }
}

public class CalendarExport : BaseModel
{
    // @Required()
    public var companyId:String?

    // @Required()
    public var bookingId:Int?

    // @Required()
    public var exceptionId:Int?

    public var calendarSync:Bool?
    public var calendarId:String
    public var isExceptionDeleted:Bool?
    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case bookingId
        case exceptionId
        case calendarSync
        case calendarId
        case isExceptionDeleted
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        exceptionId = try container.decodeIfPresent(Int.self, forKey: .exceptionId)
        calendarSync = try container.decodeIfPresent(Bool.self, forKey: .calendarSync)
        calendarId = try container.decodeIfPresent(String.self, forKey: .calendarId)
        isExceptionDeleted = try container.decodeIfPresent(Bool.self, forKey: .isExceptionDeleted)
        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 companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if exceptionId != nil { try container.encode(exceptionId, forKey: .exceptionId) }
        if calendarSync != nil { try container.encode(calendarSync, forKey: .calendarSync) }
        if calendarId != nil { try container.encode(calendarId, forKey: .calendarId) }
        if isExceptionDeleted != nil { try container.encode(isExceptionDeleted, forKey: .isExceptionDeleted) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class BookingLog : BaseModel
{
    // @References(typeof(BookingLogEventType))
    public var eventTypeId:Int

    public var eventType:BookingLogEventType
    // @Required()
    public var companyId:String?

    // @Required()
    public var bookingId:Int?

    public var id:Int
    public var comments:String
    public var userId:String
    // @Required()
    public var created:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case eventTypeId
        case eventType
        case companyId
        case bookingId
        case id
        case comments
        case userId
        case created
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        eventTypeId = try container.decodeIfPresent(Int.self, forKey: .eventTypeId)
        eventType = try container.decodeIfPresent(BookingLogEventType.self, forKey: .eventType)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        comments = try container.decodeIfPresent(String.self, forKey: .comments)
        userId = try container.decodeIfPresent(String.self, forKey: .userId)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if eventTypeId != nil { try container.encode(eventTypeId, forKey: .eventTypeId) }
        if eventType != nil { try container.encode(eventType, forKey: .eventType) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if comments != nil { try container.encode(comments, forKey: .comments) }
        if userId != nil { try container.encode(userId, forKey: .userId) }
        if created != nil { try container.encode(created, forKey: .created) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class PaymentLog : BaseModel
{
    // @References(typeof(Currency))
    public var currencyId:String

    public var currencyInfo:Currency
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var bookingId:Int?

    public var paymentReferenceId:String
    public var paymentProviderId:Int?
    public var orderItemReferenceId:String
    public var amount:Double?
    public var vat:Double?
    public var amountCredited:Double?
    public var comments:String
    // @Required()
    public var created:Date?

    // @Required()
    public var updated:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case currencyId
        case currencyInfo
        case companyId
        case id
        case bookingId
        case paymentReferenceId
        case paymentProviderId
        case orderItemReferenceId
        case amount
        case vat
        case amountCredited
        case comments
        case created
        case updated
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
        currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        paymentReferenceId = try container.decodeIfPresent(String.self, forKey: .paymentReferenceId)
        paymentProviderId = try container.decodeIfPresent(Int.self, forKey: .paymentProviderId)
        orderItemReferenceId = try container.decodeIfPresent(String.self, forKey: .orderItemReferenceId)
        amount = try container.decodeIfPresent(Double.self, forKey: .amount)
        vat = try container.decodeIfPresent(Double.self, forKey: .vat)
        amountCredited = try container.decodeIfPresent(Double.self, forKey: .amountCredited)
        comments = try container.decodeIfPresent(String.self, forKey: .comments)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
        if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if paymentReferenceId != nil { try container.encode(paymentReferenceId, forKey: .paymentReferenceId) }
        if paymentProviderId != nil { try container.encode(paymentProviderId, forKey: .paymentProviderId) }
        if orderItemReferenceId != nil { try container.encode(orderItemReferenceId, forKey: .orderItemReferenceId) }
        if amount != nil { try container.encode(amount, forKey: .amount) }
        if vat != nil { try container.encode(vat, forKey: .vat) }
        if amountCredited != nil { try container.encode(amountCredited, forKey: .amountCredited) }
        if comments != nil { try container.encode(comments, forKey: .comments) }
        if created != nil { try container.encode(created, forKey: .created) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class PaymentDetails : BaseModel, IBaseModelCreated, IBaseModelUpdated
{
    // @Ignore()
    public var qvicklyCheckoutSerialized:QvicklyCheckoutResponse

    // @Ignore()
    public var payson2CheckoutSerialized:Payson2CheckoutResponse

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

    // @Required()
    public var bookingId:Int?

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

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

    // @Required()
    public var paymentProviderId:Int?

    // @Required()
    public var isPayment:Bool?

    // @Required()
    public var createdDate:Date?

    // @Required()
    public var updatedDate:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case qvicklyCheckoutSerialized
        case payson2CheckoutSerialized
        case companyId
        case bookingId
        case externalResponseData
        case externalResponseReference
        case paymentProviderId
        case isPayment
        case createdDate
        case updatedDate
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        qvicklyCheckoutSerialized = try container.decodeIfPresent(QvicklyCheckoutResponse.self, forKey: .qvicklyCheckoutSerialized)
        payson2CheckoutSerialized = try container.decodeIfPresent(Payson2CheckoutResponse.self, forKey: .payson2CheckoutSerialized)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        externalResponseData = try container.decodeIfPresent(String.self, forKey: .externalResponseData)
        externalResponseReference = try container.decodeIfPresent(String.self, forKey: .externalResponseReference)
        paymentProviderId = try container.decodeIfPresent(Int.self, forKey: .paymentProviderId)
        isPayment = try container.decodeIfPresent(Bool.self, forKey: .isPayment)
        createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate)
        updatedDate = try container.decodeIfPresent(Date.self, forKey: .updatedDate)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if qvicklyCheckoutSerialized != nil { try container.encode(qvicklyCheckoutSerialized, forKey: .qvicklyCheckoutSerialized) }
        if payson2CheckoutSerialized != nil { try container.encode(payson2CheckoutSerialized, forKey: .payson2CheckoutSerialized) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if externalResponseData != nil { try container.encode(externalResponseData, forKey: .externalResponseData) }
        if externalResponseReference != nil { try container.encode(externalResponseReference, forKey: .externalResponseReference) }
        if paymentProviderId != nil { try container.encode(paymentProviderId, forKey: .paymentProviderId) }
        if isPayment != nil { try container.encode(isPayment, forKey: .isPayment) }
        if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) }
        if updatedDate != nil { try container.encode(updatedDate, forKey: .updatedDate) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class QvicklyCheckoutResponse : Codable
{
    public var number:Int
    public var status:String
    public var orderId:String
    public var url:String

    required public init(){}
}

public class Payson2CheckoutResponse : Codable
{
    public var id:String
    public var expirationTime:Date?
    public var snippet:String
    public var status:Payson2CheckoutStatus
    public var customer:Customer
    public var order:Order
    public var merchant:Merchant
    public var gui:Gui
    public var history:History
    public var purchaseId:Int?

    required public init(){}
}

public enum Payson2CheckoutStatus : String, Codable
{
    case None
    case Created
    case FormsFilled
    case ReadyToPay
    case ProcessingPayment
    case ReadyToShip
    case Shipped
    case PaidToAccount
    case Canceled
    case Credited
    case Expired
    case Denied
}

public class Customer : Codable
{
    public var city:String
    public var countryCode:String
    public var identityNumber:String
    public var email:String
    public var firstName:String
    public var lastName:String
    public var phone:String
    public var postalCode:String
    public var street:String
    public var reference:String
    public var type:CustomerType

    required public init(){}
}

public enum CustomerType : String, Codable
{
    case Person
    case Business
}

public class Order : Codable
{
    public var currency:Currency
    public var totalFeeExcludingTax:Double
    public var totalFeeIncludingTax:Double
    public var totalPriceExcludingTax:Double
    public var totalPriceIncludingTax:Double
    public var totalTaxAmount:Double
    public var totalCreditedAmount:Double
    public var items:IList<Item>

    required public init(){}
}

public enum Currency : Int, Codable
{
    case SEK = 1
    case EUR = 2
}

public class Item : Codable
{
    public var itemId:String
    public var discountRate:Double
    public var ean:String
    public var imageUri:Uri
    public var name:String
    public var quantity:Double
    public var reference:String
    public var taxRate:Double
    public var totalPriceExcludingTax:Double
    public var totalPriceIncludingTax:Double
    public var totalTaxAmount:Double
    public var creditedAmount:Double
    public var type:ItemType
    public var unitPrice:Double
    public var uri:Uri

    required public init(){}
}

public enum ItemType : String, Codable
{
    case Physical
    case Service
    case Fee
    case Discount
}

public class Merchant : Codable
{
    public var checkoutUri:Uri
    public var confirmationUri:Uri
    public var notificationUri:Uri
    public var validationUri:Uri
    public var termsUri:Uri
    public var reference:String
    public var partnerId:String

    required public init(){}
}

public class Gui : Codable
{
    public var colorScheme:ColorScheme
    public var locale:String
    public var requestPhone:Bool
    public var phoneOptional:Bool

    required public init(){}
}

public enum ColorScheme : String, Codable
{
    case White
    case Blue
    case Gray
    case GrayTextLogos
    case BlueTextLogos
    case WhiteTextLogos
    case WhiteNoFooter
    case GrayNoFooter
    case BlueNoFooter
}

public class History : Codable
{
    public var created:Date?
    public var readyToPay:Date?
    public var readyToShip:Date?
    public var shipped:Date?
    public var paidToAccount:Date?
    public var canceled:Date?
    public var expired:Date?
    public var denied:Date?

    required public init(){}
}

public class BookingPrice : BaseModel
{
    // @References(typeof(Currency))
    public var currencyId:String

    public var priceId:Int?
    public var currencyInfo:Currency
    // @Ignore()
    public var priceText:String

    // @Ignore()
    public var appliedCodes:[AppliedRebateCodes] = []

    // @Ignore()
    public var isRebate:Bool

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

    // @Required()
    public var bookingId:Int?

    // @Required()
    public var quantity:Int?

    public var price:Double?
    public var vat:Double?
    public var category:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    // @Required()
    public var invoiced:Bool?

    // @Required()
    public var occupiesSpot:Bool?

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case currencyId
        case priceId
        case currencyInfo
        case priceText
        case appliedCodes
        case isRebate
        case companyId
        case bookingId
        case quantity
        case price
        case vat
        case category
        case updated
        case created
        case invoiced
        case occupiesSpot
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
        priceId = try container.decodeIfPresent(Int.self, forKey: .priceId)
        currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
        priceText = try container.decodeIfPresent(String.self, forKey: .priceText)
        appliedCodes = try container.decodeIfPresent([AppliedRebateCodes].self, forKey: .appliedCodes) ?? []
        isRebate = try container.decodeIfPresent(Bool.self, forKey: .isRebate)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        quantity = try container.decodeIfPresent(Int.self, forKey: .quantity)
        price = try container.decodeIfPresent(Double.self, forKey: .price)
        vat = try container.decodeIfPresent(Double.self, forKey: .vat)
        category = try container.decodeIfPresent(String.self, forKey: .category)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        invoiced = try container.decodeIfPresent(Bool.self, forKey: .invoiced)
        occupiesSpot = try container.decodeIfPresent(Bool.self, forKey: .occupiesSpot)
        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 currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
        if priceId != nil { try container.encode(priceId, forKey: .priceId) }
        if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
        if priceText != nil { try container.encode(priceText, forKey: .priceText) }
        if appliedCodes.count > 0 { try container.encode(appliedCodes, forKey: .appliedCodes) }
        if isRebate != nil { try container.encode(isRebate, forKey: .isRebate) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if quantity != nil { try container.encode(quantity, forKey: .quantity) }
        if price != nil { try container.encode(price, forKey: .price) }
        if vat != nil { try container.encode(vat, forKey: .vat) }
        if category != nil { try container.encode(category, forKey: .category) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if invoiced != nil { try container.encode(invoiced, forKey: .invoiced) }
        if occupiesSpot != nil { try container.encode(occupiesSpot, forKey: .occupiesSpot) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class Company : BaseModel
{
    // @Ignore()
    public var status:CompanyStatus

    // @Ignore()
    public var active:Bool

    // @Ignore()
    public var customerCustomFieldsConfig:IList<CustomFieldConfig>

    // @Ignore()
    public var bookingAgreements:String

    // @Ignore()
    public var bookingSettings:BookingSettings

    // @Ignore()
    public var companyType:CompanyType

    // @Ignore()
    public var codeLockSettings:CodeLockSetting

    // @Ignore()
    public var paymentSettings:PaymentSetting

    // @Ignore()
    public var settings:CompanySetting

    // @Ignore()
    public var widgetSettings:HomepageWidgetSetting

    // @Ignore()
    public var homepageSettings:HomepageSetting

    // @Ignore()
    public var ratingScore:AverageRatingScore

    // @Ignore()
    public var ratings:[Rating] = []

    // @Ignore()
    public var distance:Double?

    // @Ignore()
    public var licenses:[License] = []

    // @Ignore()
    public var activeLicenses:[License] = []

    // @Ignore()
    public var currentLicense:License

    // @Ignore()
    public var isFreeAccount:Bool

    // @Ignore()
    public var defaultLanguage:CultureInfo

    public var category:CompanyCategory
    // @Ignore()
    public var lat:Double

    // @Ignore()
    public var lon:Double

    // @Ignore()
    public var isFavorite:Bool

    // @Ignore()
    public var externalReferences:IList<ExternalReference>

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

    // @Required()
    public var statusId:Int?

    // @Required()
    public var categoryId:Int?

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

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

    public var street1:String
    public var street2:String
    public var zipCode:String
    public var city:String
    public var openingHours:String
    public var faxNumber:String
    // @Required()
    public var email:String?

    public var phone:String
    public var details:String
    public var logoType:String
    // @Required()
    public var approvedByAdmin:Bool?

    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var ipAddress:String
    public var homepage:String
    public var domainName:String
    // @Required()
    public var countryId:String?

    // @Required()
    public var companyOwnerId:Int?

    public var typeId:Int?
    public var modifiedDate:Date?
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case status
        case active
        case customerCustomFieldsConfig
        case bookingAgreements
        case bookingSettings
        case companyType
        case codeLockSettings
        case paymentSettings
        case settings
        case widgetSettings
        case homepageSettings
        case ratingScore
        case ratings
        case distance
        case licenses
        case activeLicenses
        case currentLicense
        case isFreeAccount
        case defaultLanguage
        case category
        case lat
        case lon
        case isFavorite
        case externalReferences
        case organisationNumber
        case statusId
        case categoryId
        case sitePath
        case name
        case street1
        case street2
        case zipCode
        case city
        case openingHours
        case faxNumber
        case email
        case phone
        case details
        case logoType
        case approvedByAdmin
        case updated
        case created
        case ipAddress
        case homepage
        case domainName
        case countryId
        case companyOwnerId
        case typeId
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        status = try container.decodeIfPresent(CompanyStatus.self, forKey: .status)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        customerCustomFieldsConfig = try container.decodeIfPresent(IList<CustomFieldConfig>.self, forKey: .customerCustomFieldsConfig)
        bookingAgreements = try container.decodeIfPresent(String.self, forKey: .bookingAgreements)
        bookingSettings = try container.decodeIfPresent(BookingSettings.self, forKey: .bookingSettings)
        companyType = try container.decodeIfPresent(CompanyType.self, forKey: .companyType)
        codeLockSettings = try container.decodeIfPresent(CodeLockSetting.self, forKey: .codeLockSettings)
        paymentSettings = try container.decodeIfPresent(PaymentSetting.self, forKey: .paymentSettings)
        settings = try container.decodeIfPresent(CompanySetting.self, forKey: .settings)
        widgetSettings = try container.decodeIfPresent(HomepageWidgetSetting.self, forKey: .widgetSettings)
        homepageSettings = try container.decodeIfPresent(HomepageSetting.self, forKey: .homepageSettings)
        ratingScore = try container.decodeIfPresent(AverageRatingScore.self, forKey: .ratingScore)
        ratings = try container.decodeIfPresent([Rating].self, forKey: .ratings) ?? []
        distance = try container.decodeIfPresent(Double.self, forKey: .distance)
        licenses = try container.decodeIfPresent([License].self, forKey: .licenses) ?? []
        activeLicenses = try container.decodeIfPresent([License].self, forKey: .activeLicenses) ?? []
        currentLicense = try container.decodeIfPresent(License.self, forKey: .currentLicense)
        isFreeAccount = try container.decodeIfPresent(Bool.self, forKey: .isFreeAccount)
        defaultLanguage = try container.decodeIfPresent(CultureInfo.self, forKey: .defaultLanguage)
        category = try container.decodeIfPresent(CompanyCategory.self, forKey: .category)
        lat = try container.decodeIfPresent(Double.self, forKey: .lat)
        lon = try container.decodeIfPresent(Double.self, forKey: .lon)
        isFavorite = try container.decodeIfPresent(Bool.self, forKey: .isFavorite)
        externalReferences = try container.decodeIfPresent(IList<ExternalReference>.self, forKey: .externalReferences)
        organisationNumber = try container.decodeIfPresent(String.self, forKey: .organisationNumber)
        statusId = try container.decodeIfPresent(Int.self, forKey: .statusId)
        categoryId = try container.decodeIfPresent(Int.self, forKey: .categoryId)
        sitePath = try container.decodeIfPresent(String.self, forKey: .sitePath)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        street1 = try container.decodeIfPresent(String.self, forKey: .street1)
        street2 = try container.decodeIfPresent(String.self, forKey: .street2)
        zipCode = try container.decodeIfPresent(String.self, forKey: .zipCode)
        city = try container.decodeIfPresent(String.self, forKey: .city)
        openingHours = try container.decodeIfPresent(String.self, forKey: .openingHours)
        faxNumber = try container.decodeIfPresent(String.self, forKey: .faxNumber)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        phone = try container.decodeIfPresent(String.self, forKey: .phone)
        details = try container.decodeIfPresent(String.self, forKey: .details)
        logoType = try container.decodeIfPresent(String.self, forKey: .logoType)
        approvedByAdmin = try container.decodeIfPresent(Bool.self, forKey: .approvedByAdmin)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        ipAddress = try container.decodeIfPresent(String.self, forKey: .ipAddress)
        homepage = try container.decodeIfPresent(String.self, forKey: .homepage)
        domainName = try container.decodeIfPresent(String.self, forKey: .domainName)
        countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
        companyOwnerId = try container.decodeIfPresent(Int.self, forKey: .companyOwnerId)
        typeId = try container.decodeIfPresent(Int.self, forKey: .typeId)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if status != nil { try container.encode(status, forKey: .status) }
        if active != nil { try container.encode(active, forKey: .active) }
        if customerCustomFieldsConfig != nil { try container.encode(customerCustomFieldsConfig, forKey: .customerCustomFieldsConfig) }
        if bookingAgreements != nil { try container.encode(bookingAgreements, forKey: .bookingAgreements) }
        if bookingSettings != nil { try container.encode(bookingSettings, forKey: .bookingSettings) }
        if companyType != nil { try container.encode(companyType, forKey: .companyType) }
        if codeLockSettings != nil { try container.encode(codeLockSettings, forKey: .codeLockSettings) }
        if paymentSettings != nil { try container.encode(paymentSettings, forKey: .paymentSettings) }
        if settings != nil { try container.encode(settings, forKey: .settings) }
        if widgetSettings != nil { try container.encode(widgetSettings, forKey: .widgetSettings) }
        if homepageSettings != nil { try container.encode(homepageSettings, forKey: .homepageSettings) }
        if ratingScore != nil { try container.encode(ratingScore, forKey: .ratingScore) }
        if ratings.count > 0 { try container.encode(ratings, forKey: .ratings) }
        if distance != nil { try container.encode(distance, forKey: .distance) }
        if licenses.count > 0 { try container.encode(licenses, forKey: .licenses) }
        if activeLicenses.count > 0 { try container.encode(activeLicenses, forKey: .activeLicenses) }
        if currentLicense != nil { try container.encode(currentLicense, forKey: .currentLicense) }
        if isFreeAccount != nil { try container.encode(isFreeAccount, forKey: .isFreeAccount) }
        if defaultLanguage != nil { try container.encode(defaultLanguage, forKey: .defaultLanguage) }
        if category != nil { try container.encode(category, forKey: .category) }
        if lat != nil { try container.encode(lat, forKey: .lat) }
        if lon != nil { try container.encode(lon, forKey: .lon) }
        if isFavorite != nil { try container.encode(isFavorite, forKey: .isFavorite) }
        if externalReferences != nil { try container.encode(externalReferences, forKey: .externalReferences) }
        if organisationNumber != nil { try container.encode(organisationNumber, forKey: .organisationNumber) }
        if statusId != nil { try container.encode(statusId, forKey: .statusId) }
        if categoryId != nil { try container.encode(categoryId, forKey: .categoryId) }
        if sitePath != nil { try container.encode(sitePath, forKey: .sitePath) }
        if name != nil { try container.encode(name, forKey: .name) }
        if street1 != nil { try container.encode(street1, forKey: .street1) }
        if street2 != nil { try container.encode(street2, forKey: .street2) }
        if zipCode != nil { try container.encode(zipCode, forKey: .zipCode) }
        if city != nil { try container.encode(city, forKey: .city) }
        if openingHours != nil { try container.encode(openingHours, forKey: .openingHours) }
        if faxNumber != nil { try container.encode(faxNumber, forKey: .faxNumber) }
        if email != nil { try container.encode(email, forKey: .email) }
        if phone != nil { try container.encode(phone, forKey: .phone) }
        if details != nil { try container.encode(details, forKey: .details) }
        if logoType != nil { try container.encode(logoType, forKey: .logoType) }
        if approvedByAdmin != nil { try container.encode(approvedByAdmin, forKey: .approvedByAdmin) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if ipAddress != nil { try container.encode(ipAddress, forKey: .ipAddress) }
        if homepage != nil { try container.encode(homepage, forKey: .homepage) }
        if domainName != nil { try container.encode(domainName, forKey: .domainName) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if companyOwnerId != nil { try container.encode(companyOwnerId, forKey: .companyOwnerId) }
        if typeId != nil { try container.encode(typeId, forKey: .typeId) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public enum CompanyStatus : Int, Codable
{
    case Registered = 1
    case AwaitingApproval = 2
    case Approved = 3
    case Inactive = 4
    case ClosedDown = 5
    case NotApproved = 6
}

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class CodeLockSetting : BaseModel
{
    // @Ignore()
    public var codeLockSystemOptions:[CodeLockSystem] = []

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

    // @Required()
    public var codeLockSystemsId:Int?

    // @Required()
    public var validBeforeMinutes:Int?

    // @Required()
    public var validAfterMinutes:Int?

    // @Required()
    public var deleteOldBySchedule:Bool?

    // @Required()
    public var created:Date?

    // @Required()
    public var updated:Date?

    public var modifiedDate:Date?
    // @Required()
    public var sendEmailNotification:Bool?

    // @Required()
    public var sendSMSNotification:Bool?

    // @Required()
    public var emailNotificationTime:Int16?

    // @Required()
    public var smsNotificationTime:Int16?

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

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

    private enum CodingKeys : String, CodingKey {
        case codeLockSystemOptions
        case active
        case codeLockSystemsId
        case validBeforeMinutes
        case validAfterMinutes
        case deleteOldBySchedule
        case created
        case updated
        case modifiedDate
        case sendEmailNotification
        case sendSMSNotification
        case emailNotificationTime
        case smsNotificationTime
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        codeLockSystemOptions = try container.decodeIfPresent([CodeLockSystem].self, forKey: .codeLockSystemOptions) ?? []
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        codeLockSystemsId = try container.decodeIfPresent(Int.self, forKey: .codeLockSystemsId)
        validBeforeMinutes = try container.decodeIfPresent(Int.self, forKey: .validBeforeMinutes)
        validAfterMinutes = try container.decodeIfPresent(Int.self, forKey: .validAfterMinutes)
        deleteOldBySchedule = try container.decodeIfPresent(Bool.self, forKey: .deleteOldBySchedule)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        sendEmailNotification = try container.decodeIfPresent(Bool.self, forKey: .sendEmailNotification)
        sendSMSNotification = try container.decodeIfPresent(Bool.self, forKey: .sendSMSNotification)
        emailNotificationTime = try container.decodeIfPresent(Int16.self, forKey: .emailNotificationTime)
        smsNotificationTime = try container.decodeIfPresent(Int16.self, forKey: .smsNotificationTime)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if codeLockSystemOptions.count > 0 { try container.encode(codeLockSystemOptions, forKey: .codeLockSystemOptions) }
        if active != nil { try container.encode(active, forKey: .active) }
        if codeLockSystemsId != nil { try container.encode(codeLockSystemsId, forKey: .codeLockSystemsId) }
        if validBeforeMinutes != nil { try container.encode(validBeforeMinutes, forKey: .validBeforeMinutes) }
        if validAfterMinutes != nil { try container.encode(validAfterMinutes, forKey: .validAfterMinutes) }
        if deleteOldBySchedule != nil { try container.encode(deleteOldBySchedule, forKey: .deleteOldBySchedule) }
        if created != nil { try container.encode(created, forKey: .created) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if sendEmailNotification != nil { try container.encode(sendEmailNotification, forKey: .sendEmailNotification) }
        if sendSMSNotification != nil { try container.encode(sendSMSNotification, forKey: .sendSMSNotification) }
        if emailNotificationTime != nil { try container.encode(emailNotificationTime, forKey: .emailNotificationTime) }
        if smsNotificationTime != nil { try container.encode(smsNotificationTime, forKey: .smsNotificationTime) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case supplier
        case logoType
        case Description
        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)
        supplier = try container.decodeIfPresent(String.self, forKey: .supplier)
        logoType = try container.decodeIfPresent(String.self, forKey: .logoType)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 supplier != nil { try container.encode(supplier, forKey: .supplier) }
        if logoType != nil { try container.encode(logoType, forKey: .logoType) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class CompanySetting : BaseModel
{
    // @Ignore()
    public var languages:[LanguageResponse] = []

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

    public var inactiveMessage:String
    // @Required()
    public var searchable:Bool?

    public var gaTrackingId:String
    public var facebookPixelId:String
    // @Required()
    public var multiLanguage:Bool?

    // @Required()
    public var enableAPITranslation:Bool?

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

    public var modifiedDate:Date?
    public var gtmTrackingId:String
    // @Required()
    public var showOnMarketPlace:Bool?

    public var googleAdsConversionId:String
    public var linkedinTagId:String
    public var googleAdsConversionLabel:String
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case languages
        case active
        case inactiveMessage
        case searchable
        case gaTrackingId
        case facebookPixelId
        case multiLanguage
        case enableAPITranslation
        case defaultLanguage
        case modifiedDate
        case gtmTrackingId
        case showOnMarketPlace
        case googleAdsConversionId
        case linkedinTagId
        case googleAdsConversionLabel
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        languages = try container.decodeIfPresent([LanguageResponse].self, forKey: .languages) ?? []
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        inactiveMessage = try container.decodeIfPresent(String.self, forKey: .inactiveMessage)
        searchable = try container.decodeIfPresent(Bool.self, forKey: .searchable)
        gaTrackingId = try container.decodeIfPresent(String.self, forKey: .gaTrackingId)
        facebookPixelId = try container.decodeIfPresent(String.self, forKey: .facebookPixelId)
        multiLanguage = try container.decodeIfPresent(Bool.self, forKey: .multiLanguage)
        enableAPITranslation = try container.decodeIfPresent(Bool.self, forKey: .enableAPITranslation)
        defaultLanguage = try container.decodeIfPresent(String.self, forKey: .defaultLanguage)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        gtmTrackingId = try container.decodeIfPresent(String.self, forKey: .gtmTrackingId)
        showOnMarketPlace = try container.decodeIfPresent(Bool.self, forKey: .showOnMarketPlace)
        googleAdsConversionId = try container.decodeIfPresent(String.self, forKey: .googleAdsConversionId)
        linkedinTagId = try container.decodeIfPresent(String.self, forKey: .linkedinTagId)
        googleAdsConversionLabel = try container.decodeIfPresent(String.self, forKey: .googleAdsConversionLabel)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if languages.count > 0 { try container.encode(languages, forKey: .languages) }
        if active != nil { try container.encode(active, forKey: .active) }
        if inactiveMessage != nil { try container.encode(inactiveMessage, forKey: .inactiveMessage) }
        if searchable != nil { try container.encode(searchable, forKey: .searchable) }
        if gaTrackingId != nil { try container.encode(gaTrackingId, forKey: .gaTrackingId) }
        if facebookPixelId != nil { try container.encode(facebookPixelId, forKey: .facebookPixelId) }
        if multiLanguage != nil { try container.encode(multiLanguage, forKey: .multiLanguage) }
        if enableAPITranslation != nil { try container.encode(enableAPITranslation, forKey: .enableAPITranslation) }
        if defaultLanguage != nil { try container.encode(defaultLanguage, forKey: .defaultLanguage) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if gtmTrackingId != nil { try container.encode(gtmTrackingId, forKey: .gtmTrackingId) }
        if showOnMarketPlace != nil { try container.encode(showOnMarketPlace, forKey: .showOnMarketPlace) }
        if googleAdsConversionId != nil { try container.encode(googleAdsConversionId, forKey: .googleAdsConversionId) }
        if linkedinTagId != nil { try container.encode(linkedinTagId, forKey: .linkedinTagId) }
        if googleAdsConversionLabel != nil { try container.encode(googleAdsConversionLabel, forKey: .googleAdsConversionLabel) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class LanguageResponse : Codable
{
    public var id:String
    public var name:String

    required public init(){}
}

public class HomepageWidgetSetting : BaseModel
{
    // @Ignore()
    public var widgetServiceLayoutOptions:[WidgetServiceLayouts] = []

    // @Ignore()
    public var widgetTimeLayoutOptions:[WidgetTimeLayouts] = []

    // @Ignore()
    public var widgetBookingLayoutOptions:[WidgetBookingLayouts] = []

    // @Ignore()
    public var widgetBookingMethodOptions:[WidgetBookingMethods] = []

    // @Required()
    public var serviceLayoutId:Int?

    // @Required()
    public var timeLayoutId:Int?

    // @Required()
    public var bookingLayoutId:Int?

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

    // @Required()
    public var showServiceImage:Bool?

    // @Required()
    public var showNextAvailableTime:Bool?

    // @Required()
    public var showEndTime:Bool?

    public var bookedTimeSlotText:String
    // @Required()
    public var darkTheme:Bool?

    // @Required()
    public var showRebateCodeField:Bool?

    public var modifiedDate:Date?
    // @Required()
    public var enableCreateAccount:Bool?

    // @Required()
    public var enableLogin:Bool?

    // @Required()
    public var enableDirectBooking:Bool?

    // @Required()
    public var enableFacebookLogin:Bool?

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

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

    private enum CodingKeys : String, CodingKey {
        case widgetServiceLayoutOptions
        case widgetTimeLayoutOptions
        case widgetBookingLayoutOptions
        case widgetBookingMethodOptions
        case serviceLayoutId
        case timeLayoutId
        case bookingLayoutId
        case primaryColor
        case showServiceImage
        case showNextAvailableTime
        case showEndTime
        case bookedTimeSlotText
        case darkTheme
        case showRebateCodeField
        case modifiedDate
        case enableCreateAccount
        case enableLogin
        case enableDirectBooking
        case enableFacebookLogin
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        widgetServiceLayoutOptions = try container.decodeIfPresent([WidgetServiceLayouts].self, forKey: .widgetServiceLayoutOptions) ?? []
        widgetTimeLayoutOptions = try container.decodeIfPresent([WidgetTimeLayouts].self, forKey: .widgetTimeLayoutOptions) ?? []
        widgetBookingLayoutOptions = try container.decodeIfPresent([WidgetBookingLayouts].self, forKey: .widgetBookingLayoutOptions) ?? []
        widgetBookingMethodOptions = try container.decodeIfPresent([WidgetBookingMethods].self, forKey: .widgetBookingMethodOptions) ?? []
        serviceLayoutId = try container.decodeIfPresent(Int.self, forKey: .serviceLayoutId)
        timeLayoutId = try container.decodeIfPresent(Int.self, forKey: .timeLayoutId)
        bookingLayoutId = try container.decodeIfPresent(Int.self, forKey: .bookingLayoutId)
        primaryColor = try container.decodeIfPresent(String.self, forKey: .primaryColor)
        showServiceImage = try container.decodeIfPresent(Bool.self, forKey: .showServiceImage)
        showNextAvailableTime = try container.decodeIfPresent(Bool.self, forKey: .showNextAvailableTime)
        showEndTime = try container.decodeIfPresent(Bool.self, forKey: .showEndTime)
        bookedTimeSlotText = try container.decodeIfPresent(String.self, forKey: .bookedTimeSlotText)
        darkTheme = try container.decodeIfPresent(Bool.self, forKey: .darkTheme)
        showRebateCodeField = try container.decodeIfPresent(Bool.self, forKey: .showRebateCodeField)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        enableCreateAccount = try container.decodeIfPresent(Bool.self, forKey: .enableCreateAccount)
        enableLogin = try container.decodeIfPresent(Bool.self, forKey: .enableLogin)
        enableDirectBooking = try container.decodeIfPresent(Bool.self, forKey: .enableDirectBooking)
        enableFacebookLogin = try container.decodeIfPresent(Bool.self, forKey: .enableFacebookLogin)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if widgetServiceLayoutOptions.count > 0 { try container.encode(widgetServiceLayoutOptions, forKey: .widgetServiceLayoutOptions) }
        if widgetTimeLayoutOptions.count > 0 { try container.encode(widgetTimeLayoutOptions, forKey: .widgetTimeLayoutOptions) }
        if widgetBookingLayoutOptions.count > 0 { try container.encode(widgetBookingLayoutOptions, forKey: .widgetBookingLayoutOptions) }
        if widgetBookingMethodOptions.count > 0 { try container.encode(widgetBookingMethodOptions, forKey: .widgetBookingMethodOptions) }
        if serviceLayoutId != nil { try container.encode(serviceLayoutId, forKey: .serviceLayoutId) }
        if timeLayoutId != nil { try container.encode(timeLayoutId, forKey: .timeLayoutId) }
        if bookingLayoutId != nil { try container.encode(bookingLayoutId, forKey: .bookingLayoutId) }
        if primaryColor != nil { try container.encode(primaryColor, forKey: .primaryColor) }
        if showServiceImage != nil { try container.encode(showServiceImage, forKey: .showServiceImage) }
        if showNextAvailableTime != nil { try container.encode(showNextAvailableTime, forKey: .showNextAvailableTime) }
        if showEndTime != nil { try container.encode(showEndTime, forKey: .showEndTime) }
        if bookedTimeSlotText != nil { try container.encode(bookedTimeSlotText, forKey: .bookedTimeSlotText) }
        if darkTheme != nil { try container.encode(darkTheme, forKey: .darkTheme) }
        if showRebateCodeField != nil { try container.encode(showRebateCodeField, forKey: .showRebateCodeField) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if enableCreateAccount != nil { try container.encode(enableCreateAccount, forKey: .enableCreateAccount) }
        if enableLogin != nil { try container.encode(enableLogin, forKey: .enableLogin) }
        if enableDirectBooking != nil { try container.encode(enableDirectBooking, forKey: .enableDirectBooking) }
        if enableFacebookLogin != nil { try container.encode(enableFacebookLogin, forKey: .enableFacebookLogin) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case code
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        code = try container.decodeIfPresent(String.self, forKey: .code)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if code != nil { try container.encode(code, forKey: .code) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case code
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        code = try container.decodeIfPresent(String.self, forKey: .code)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if code != nil { try container.encode(code, forKey: .code) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case code
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        code = try container.decodeIfPresent(String.self, forKey: .code)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if code != nil { try container.encode(code, forKey: .code) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case code
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        code = try container.decodeIfPresent(String.self, forKey: .code)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if code != nil { try container.encode(code, forKey: .code) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class HomepageSetting : BaseModel, ICompany
{
    // @Ignore()
    public var homepageTemplateOptions:[HomepageTemplate] = []

    // @Ignore()
    public var homepageHeroSectionStyleOptions:[HeroSectionStyle] = []

    // @Ignore()
    public var companyId:String?

    public var welcomePageHeading:String
    public var welcomePageBody:String
    public var aboutUsPageHeading:String
    public var aboutUsPageBody:String
    // @Required()
    public var homePageTemplateId:Int?

    public var imageUrl:String
    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var homepageHeading:String
    // @Required()
    public var heroSectionStyleId:Int?

    public var modifiedDate:Date?
    // @Required()
    public var showRating:Bool?

    // @Required()
    public var enableHomepage:Bool?

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

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

    private enum CodingKeys : String, CodingKey {
        case homepageTemplateOptions
        case homepageHeroSectionStyleOptions
        case companyId
        case welcomePageHeading
        case welcomePageBody
        case aboutUsPageHeading
        case aboutUsPageBody
        case homePageTemplateId
        case imageUrl
        case updated
        case created
        case homepageHeading
        case heroSectionStyleId
        case modifiedDate
        case showRating
        case enableHomepage
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        homepageTemplateOptions = try container.decodeIfPresent([HomepageTemplate].self, forKey: .homepageTemplateOptions) ?? []
        homepageHeroSectionStyleOptions = try container.decodeIfPresent([HeroSectionStyle].self, forKey: .homepageHeroSectionStyleOptions) ?? []
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        welcomePageHeading = try container.decodeIfPresent(String.self, forKey: .welcomePageHeading)
        welcomePageBody = try container.decodeIfPresent(String.self, forKey: .welcomePageBody)
        aboutUsPageHeading = try container.decodeIfPresent(String.self, forKey: .aboutUsPageHeading)
        aboutUsPageBody = try container.decodeIfPresent(String.self, forKey: .aboutUsPageBody)
        homePageTemplateId = try container.decodeIfPresent(Int.self, forKey: .homePageTemplateId)
        imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        homepageHeading = try container.decodeIfPresent(String.self, forKey: .homepageHeading)
        heroSectionStyleId = try container.decodeIfPresent(Int.self, forKey: .heroSectionStyleId)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        showRating = try container.decodeIfPresent(Bool.self, forKey: .showRating)
        enableHomepage = try container.decodeIfPresent(Bool.self, forKey: .enableHomepage)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if homepageTemplateOptions.count > 0 { try container.encode(homepageTemplateOptions, forKey: .homepageTemplateOptions) }
        if homepageHeroSectionStyleOptions.count > 0 { try container.encode(homepageHeroSectionStyleOptions, forKey: .homepageHeroSectionStyleOptions) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if welcomePageHeading != nil { try container.encode(welcomePageHeading, forKey: .welcomePageHeading) }
        if welcomePageBody != nil { try container.encode(welcomePageBody, forKey: .welcomePageBody) }
        if aboutUsPageHeading != nil { try container.encode(aboutUsPageHeading, forKey: .aboutUsPageHeading) }
        if aboutUsPageBody != nil { try container.encode(aboutUsPageBody, forKey: .aboutUsPageBody) }
        if homePageTemplateId != nil { try container.encode(homePageTemplateId, forKey: .homePageTemplateId) }
        if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if homepageHeading != nil { try container.encode(homepageHeading, forKey: .homepageHeading) }
        if heroSectionStyleId != nil { try container.encode(heroSectionStyleId, forKey: .heroSectionStyleId) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if showRating != nil { try container.encode(showRating, forKey: .showRating) }
        if enableHomepage != nil { try container.encode(enableHomepage, forKey: .enableHomepage) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case imageUrl
        case premium
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        imageUrl = try container.decodeIfPresent(Uri.self, forKey: .imageUrl)
        premium = try container.decodeIfPresent(Bool.self, forKey: .premium)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) }
        if premium != nil { try container.encode(premium, forKey: .premium) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

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

    public var Description:String
    public var modifiedDate:Date?
    // @Required()
    public var id:Int?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class AverageRatingScore : Codable
{
    public var averageScore:Double
    public var score1Count:Int
    public var score2Count:Int
    public var score3Count:Int
    public var score4Count:Int
    public var score5Count:Int
    public var count:Int

    required public init(){}
}

public class Rating : BaseModel
{
    public var reviewId:String?
    public var review:Review
    // @Required()
    public var companyId:String?

    // @Required()
    public var bookingId:Int?

    // @Required()
    public var ratingScore:Int?

    // @Required()
    public var status:Int?

    // @Required()
    public var created:Date?

    // @Required()
    public var updated:Date?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case reviewId
        case review
        case companyId
        case bookingId
        case ratingScore
        case status
        case created
        case updated
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        reviewId = try container.decodeIfPresent(String.self, forKey: .reviewId)
        review = try container.decodeIfPresent(Review.self, forKey: .review)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId)
        ratingScore = try container.decodeIfPresent(Int.self, forKey: .ratingScore)
        status = try container.decodeIfPresent(Int.self, forKey: .status)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if reviewId != nil { try container.encode(reviewId, forKey: .reviewId) }
        if review != nil { try container.encode(review, forKey: .review) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) }
        if ratingScore != nil { try container.encode(ratingScore, forKey: .ratingScore) }
        if status != nil { try container.encode(status, forKey: .status) }
        if created != nil { try container.encode(created, forKey: .created) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class Review : BaseModel
{
    public var reviewId:String
    // @Required()
    public var companyId:String?

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

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

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

    // @Required()
    public var status:Int?

    // @Required()
    public var created:Date?

    // @Required()
    public var updated:Date?

    public var modifiedDate:Date?
    public var reviewAnswer:String

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

    private enum CodingKeys : String, CodingKey {
        case reviewId
        case companyId
        case title
        case Description
        case author
        case status
        case created
        case updated
        case modifiedDate
        case reviewAnswer
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        reviewId = try container.decodeIfPresent(String.self, forKey: .reviewId)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        title = try container.decodeIfPresent(String.self, forKey: .title)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        author = try container.decodeIfPresent(String.self, forKey: .author)
        status = try container.decodeIfPresent(Int.self, forKey: .status)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        reviewAnswer = try container.decodeIfPresent(String.self, forKey: .reviewAnswer)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if reviewId != nil { try container.encode(reviewId, forKey: .reviewId) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if title != nil { try container.encode(title, forKey: .title) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if author != nil { try container.encode(author, forKey: .author) }
        if status != nil { try container.encode(status, forKey: .status) }
        if created != nil { try container.encode(created, forKey: .created) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if reviewAnswer != nil { try container.encode(reviewAnswer, forKey: .reviewAnswer) }
    }
}

public class License : BaseModel
{
    public var type:LicenseType
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var typeId:Int?

    // @Required()
    public var validFrom:Date?

    // @Required()
    public var validTo:Date?

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

    // @Required()
    public var updated:Date?

    // @Required()
    public var created:Date?

    public var modifiedDate:Date?
    public var metaData:String

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

    private enum CodingKeys : String, CodingKey {
        case type
        case companyId
        case id
        case typeId
        case validFrom
        case validTo
        case active
        case updated
        case created
        case modifiedDate
        case metaData
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        type = try container.decodeIfPresent(LicenseType.self, forKey: .type)
        companyId = try container.decodeIfPresent(String.self, forKey: .companyId)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        typeId = try container.decodeIfPresent(Int.self, forKey: .typeId)
        validFrom = try container.decodeIfPresent(Date.self, forKey: .validFrom)
        validTo = try container.decodeIfPresent(Date.self, forKey: .validTo)
        active = try container.decodeIfPresent(Bool.self, forKey: .active)
        updated = try container.decodeIfPresent(Date.self, forKey: .updated)
        created = try container.decodeIfPresent(Date.self, forKey: .created)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        metaData = try container.decodeIfPresent(String.self, forKey: .metaData)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if type != nil { try container.encode(type, forKey: .type) }
        if companyId != nil { try container.encode(companyId, forKey: .companyId) }
        if id != nil { try container.encode(id, forKey: .id) }
        if typeId != nil { try container.encode(typeId, forKey: .typeId) }
        if validFrom != nil { try container.encode(validFrom, forKey: .validFrom) }
        if validTo != nil { try container.encode(validTo, forKey: .validTo) }
        if active != nil { try container.encode(active, forKey: .active) }
        if updated != nil { try container.encode(updated, forKey: .updated) }
        if created != nil { try container.encode(created, forKey: .created) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if metaData != nil { try container.encode(metaData, forKey: .metaData) }
    }
}

public class LicenseType : BaseModel
{
    // @Ignore()
    public var licenseItems:IList<LicenseTypeItem>

    // @Ignore()
    public var prices:IList<LicensePrice>

    // @Ignore()
    public var periodOfNoticeDays:Int

    // @Ignore()
    public var nextLicenseOption:LicenseType

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

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

    // @Required()
    public var extraLicenseOption:Bool?

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case licenseItems
        case prices
        case periodOfNoticeDays
        case nextLicenseOption
        case name
        case Description
        case extraLicenseOption
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        licenseItems = try container.decodeIfPresent(IList<LicenseTypeItem>.self, forKey: .licenseItems)
        prices = try container.decodeIfPresent(IList<LicensePrice>.self, forKey: .prices)
        periodOfNoticeDays = try container.decodeIfPresent(Int.self, forKey: .periodOfNoticeDays)
        nextLicenseOption = try container.decodeIfPresent(LicenseType.self, forKey: .nextLicenseOption)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        extraLicenseOption = try container.decodeIfPresent(Bool.self, forKey: .extraLicenseOption)
        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 licenseItems != nil { try container.encode(licenseItems, forKey: .licenseItems) }
        if prices != nil { try container.encode(prices, forKey: .prices) }
        if periodOfNoticeDays != nil { try container.encode(periodOfNoticeDays, forKey: .periodOfNoticeDays) }
        if nextLicenseOption != nil { try container.encode(nextLicenseOption, forKey: .nextLicenseOption) }
        if name != nil { try container.encode(name, forKey: .name) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if extraLicenseOption != nil { try container.encode(extraLicenseOption, forKey: .extraLicenseOption) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class LicenseTypeItem : BaseModel
{
    // @Ignore()
    public var name:String

    // @Required()
    public var licenseTypesId:Int?

    // @Required()
    public var licenseItemsId:Int?

    // @Required()
    public var numberOfItems:Int?

    public var id:Int
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case licenseTypesId
        case licenseItemsId
        case numberOfItems
        case id
        case modifiedDate
    }

    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)
        licenseTypesId = try container.decodeIfPresent(Int.self, forKey: .licenseTypesId)
        licenseItemsId = try container.decodeIfPresent(Int.self, forKey: .licenseItemsId)
        numberOfItems = try container.decodeIfPresent(Int.self, forKey: .numberOfItems)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    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 licenseTypesId != nil { try container.encode(licenseTypesId, forKey: .licenseTypesId) }
        if licenseItemsId != nil { try container.encode(licenseItemsId, forKey: .licenseItemsId) }
        if numberOfItems != nil { try container.encode(numberOfItems, forKey: .numberOfItems) }
        if id != nil { try container.encode(id, forKey: .id) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class LicensePrice : BaseModel
{
    // @Ignore()
    public var country:Country

    // @Ignore()
    public var monthlyPayment:Bool

    // @Required()
    public var licenseTypeId:Int?

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

    // @Required()
    public var price:Int?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case country
        case monthlyPayment
        case licenseTypeId
        case countryId
        case price
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        country = try container.decodeIfPresent(Country.self, forKey: .country)
        monthlyPayment = try container.decodeIfPresent(Bool.self, forKey: .monthlyPayment)
        licenseTypeId = try container.decodeIfPresent(Int.self, forKey: .licenseTypeId)
        countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
        price = try container.decodeIfPresent(Int.self, forKey: .price)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if country != nil { try container.encode(country, forKey: .country) }
        if monthlyPayment != nil { try container.encode(monthlyPayment, forKey: .monthlyPayment) }
        if licenseTypeId != nil { try container.encode(licenseTypeId, forKey: .licenseTypeId) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if price != nil { try container.encode(price, forKey: .price) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class Country : BaseModel
{
    // @References(typeof(Currency))
    public var currencyId:String

    public var currencyInfo:Currency
    // @Required()
    public var name:String?

    public var culture:String
    public var timeZone:String
    public var modifiedDate:Date?
    // @Required()
    public var id:String?

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

    private enum CodingKeys : String, CodingKey {
        case currencyId
        case currencyInfo
        case name
        case culture
        case timeZone
        case modifiedDate
        case id
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
        currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        culture = try container.decodeIfPresent(String.self, forKey: .culture)
        timeZone = try container.decodeIfPresent(String.self, forKey: .timeZone)
        modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
        id = try container.decodeIfPresent(String.self, forKey: .id)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
        if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
        if name != nil { try container.encode(name, forKey: .name) }
        if culture != nil { try container.encode(culture, forKey: .culture) }
        if timeZone != nil { try container.encode(timeZone, forKey: .timeZone) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        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 BookingStatus : BaseModel
{
    // @Required()
    public var name:String?

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

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

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

    public var modifiedDate:Date?
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case name
        case Description
        case color
        case icon
        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)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        color = try container.decodeIfPresent(String.self, forKey: .color)
        icon = try container.decodeIfPresent(String.self, forKey: .icon)
        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 Description != nil { try container.encode(Description, forKey: .Description) }
        if color != nil { try container.encode(color, forKey: .color) }
        if icon != nil { try container.encode(icon, forKey: .icon) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
        if id != nil { try container.encode(id, forKey: .id) }
    }
}

public class BookedResourceType : Codable
{
    /**
    * The resource type id
    */
    // @ApiMember(Description="The resource type id")
    public var id:Int

    /**
    * The resource type name
    */
    // @ApiMember(Description="The resource type name")
    public var name:String

    /**
    * The resources inside resource type
    */
    // @ApiMember(Description="The resources inside resource type")
    public var resources:[BookedResource] = []

    required public init(){}
}

public class BookedResource : Codable
{
    public var id:Int
    public var name:String
    public var color:String
    public var imageUrl:Uri
    public var email:String
    public var mobilePhone:String
    public var accessGroup:String
    public var emailNotification:Bool
    public var smsNotification:Bool
    public var emailReminder:Bool
    public var smsReminder:Bool

    required public init(){}
}

public class CustomFieldServiceRelation : BaseModel
{
    // @Required()
    public var companyId:String?

    public var id:Int
    // @Required()
    public var customFieldConfigId:Int?

    // @Required()
    public var serviceId:Int?

    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case companyId
        case id
        case customFieldConfigId
        case serviceId
        case modifiedDate
    }

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

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

public class KeyCloakRole : Codable
{
    public var id:String
    public var name:String

    required public init(){}
}

public class SupportCaseQueryResponse : Codable
{
    /**
    * The support case id
    */
    // @ApiMember(Description="The support case id")
    public var id:Int

    /**
    * The company user id
    */
    // @ApiMember(Description="The company user id")
    public var companyUserId:String

    /**
    * The case title.
    */
    // @ApiMember(Description="The case title.")
    public var title:String

    /**
    * The case description.
    */
    // @ApiMember(Description="The case description.")
    public var Description:String

    /**
    * The case status id.
    */
    // @ApiMember(Description="The case status id.")
    public var caseStatusId:Int

    /**
    * If the case type id.
    */
    // @ApiMember(Description="If the case type id.")
    public var caseTypeId:Int

    /**
    * If the case area id.
    */
    // @ApiMember(Description="If the case area id.")
    public var caseAreaId:Int

    /**
    * The case created by.
    */
    // @ApiMember(Description="The case created by.")
    public var createdBy:String

    /**
    * The case updated by.
    */
    // @ApiMember(Description="The case updated by.")
    public var updatedBy:String

    /**
    * The case solved by.
    */
    // @ApiMember(Description="The case solved by.")
    public var solvedBy:String

    /**
    * If case updated date.
    */
    // @ApiMember(Description="If case updated date.")
    public var updated:Date

    /**
    * If case created date.
    */
    // @ApiMember(Description="If case created date.")
    public var created:Date

    /**
    * Who owns the support case.
    */
    // @ApiMember(Description="Who owns the support case.")
    public var caseOwner:String

    /**
    * The case status information.
    */
    // @ApiMember(Description="The case status information.")
    public var caseStatus:SupportCaseStatusResponse

    /**
    * The case type information.
    */
    // @ApiMember(Description="The case type information.")
    public var caseType:SupportCaseTypeResponse

    /**
    * The case area information.
    */
    // @ApiMember(Description="The case area information.")
    public var caseArea:SupportCaseAreaResponse

    /**
    * The case comments.
    */
    // @ApiMember(Description="The case comments.")
    public var comments:[SupportCaseCommentsResponse] = []

    /**
    * The case attachments.
    */
    // @ApiMember(Description="The case attachments.")
    public var attachments:[SupportCaseAttachmentResponse] = []

    /**
    * The case status options to select from.
    */
    // @ApiMember(Description="The case status options to select from.")
    public var caseStatusOptions:[SupportCaseStatusResponse] = []

    /**
    * The case type  options to select from.
    */
    // @ApiMember(Description="The case type  options to select from.")
    public var caseTypeOptions:[SupportCaseTypeResponse] = []

    /**
    * The case area  options to select from.
    */
    // @ApiMember(Description="The case area  options to select from.")
    public var caseAreaOptions:[SupportCaseAreaResponse] = []

    required public init(){}
}

public class SupportCaseStatusResponse : Codable
{
    /**
    * The status id
    */
    // @ApiMember(Description="The status id")
    public var id:Int

    /**
    * The status name
    */
    // @ApiMember(Description="The status name")
    public var name:String

    /**
    * The status description
    */
    // @ApiMember(Description="The status description")
    public var Description:String

    /**
    * The status icon
    */
    // @ApiMember(Description="The status icon")
    public var icon:String

    /**
    * The status color
    */
    // @ApiMember(Description="The status color")
    public var color:String

    required public init(){}
}

public class SupportCaseTypeResponse : Codable
{
    /**
    * The type id
    */
    // @ApiMember(Description="The type id")
    public var id:Int

    /**
    * The type name
    */
    // @ApiMember(Description="The type name")
    public var name:String

    /**
    * The type description
    */
    // @ApiMember(Description="The type description")
    public var Description:String

    required public init(){}
}

public class SupportCaseAreaResponse : Codable
{
    /**
    * The area id
    */
    // @ApiMember(Description="The area id")
    public var id:Int

    /**
    * The area name
    */
    // @ApiMember(Description="The area name")
    public var name:String

    /**
    * The area description
    */
    // @ApiMember(Description="The area description")
    public var Description:String

    required public init(){}
}

public class SupportCaseCommentsResponse : Codable
{
    /**
    * The case id
    */
    // @ApiMember(Description="The case id")
    public var supportCaseId:Int

    /**
    * The comments id
    */
    // @ApiMember(Description="The comments id")
    public var id:Int

    /**
    * The case comment
    */
    // @ApiMember(Description="The case comment")
    public var comment:String

    /**
    * The case comment created by
    */
    // @ApiMember(Description="The case comment created by")
    public var createdBy:String

    /**
    * The case comment created date
    */
    // @ApiMember(Description="The case comment created date")
    public var created:Date

    required public init(){}
}

public class SupportCaseAttachmentResponse : Codable
{
    /**
    * The attachment id
    */
    // @ApiMember(Description="The attachment id")
    public var id:Int

    /**
    * The attachment file url
    */
    // @ApiMember(Description="The attachment file url")
    public var fileUrl:String

    required public init(){}
}

public class AccessKeyTypeResponse : Codable
{
    public var id:Int
    public var keyType:String
    public var Description:String

    required public init(){}
}


Swift SuperAdminSupportCaseQuery DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /superadmin/support/cases HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"Id":0,"Title":"String","Description":"String","CaseStatusId":0,"CaseTypeId":0,"CaseAreaId":0,"CreatedBy":"String","UpdatedBy":"String","SolvedBy":"String","CaseOwner":"String","CaseStatus":{"Id":0,"Name":"String","Description":"String","Icon":"String","Color":"String"},"CaseType":{"Id":0,"Name":"String","Description":"String"},"CaseArea":{"Id":0,"Name":"String","Description":"String"},"Comments":[{"SupportCaseId":0,"Id":0,"Comment":"String","CreatedBy":"String"}],"Attachments":[{"Id":0,"FileUrl":"String"}],"CaseStatusOptions":[{"Id":0,"Name":"String","Description":"String","Icon":"String","Color":"String"}],"CaseTypeOptions":[{"Id":0,"Name":"String","Description":"String"}],"CaseAreaOptions":[{"Id":0,"Name":"String","Description":"String"}]}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}