/* Options:
Date: 2025-03-15 21:23:54
SwiftVersion: 5.0
Version: 8.30
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://api.sanctionssearch.com/v2

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

import Foundation
import ServiceStack

// @Route("/bulksearches/list", "POST")
// @DataContract
public class GetBulkSearchHistory : BaseRequest, IReturn
{
    public typealias Return = GetBulkSearchHistoryResponse

    // @DataMember
    public var request:GetBulkSearchHistoryRequest

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

    private enum CodingKeys : String, CodingKey {
        case request
    }

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

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

// @DataContract
public class GetBulkSearchHistoryResponse : Codable
{
    // @DataMember
    public var data:GetBulkSearchHistoryData

    required public init(){}
}

// @DataContract
public class Authentication : Codable
{
    /**
    * The API User ID provided by us when you signed up to use our API
    */
    // @DataMember
    // @ApiMember(Description="The API User ID provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
    public var apiUserId:String

    /**
    * The API User Key provided by us when you signed up to use our API
    */
    // @DataMember
    // @ApiMember(Description="The API User Key provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
    public var apiUserKey:String

    required public init(){}
}

// @DataContract
public class BaseRequest : IBaseRequest, Codable
{
    /**
    * The authentication credentials
    */
    // @DataMember
    // @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
    public var authentication:Authentication

    required public init(){}
}

public protocol IBaseRequest
{
    var authentication:Authentication { get set }

}

public class GetBulkSearchHistoryRequest : Codable
{
    public var subUserName:String
    public var page:Int
    public var sortOrder:String
    /**
    * The user id to filter on, in string format (GUID)
    */
    // @ApiMember(Description="The user id to filter on, in string format (GUID)")
    public var whereUserId:String

    public var whereDateFrom:Date?
    public var whereDateTo:Date?
    public var whereId:Int?
    public var pageSize:Int

    required public init(){}
}

public class GetBulkSearchHistoryData : BaseResponse
{
    public var bulkSearchList:ArrayOfBulkSearchStatus
    public var currentPageNum:Int
    public var maxPageNum:Int
    public var totalBulkSearches:Int
    public var pageSize:Int

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

    private enum CodingKeys : String, CodingKey {
        case bulkSearchList
        case currentPageNum
        case maxPageNum
        case totalBulkSearches
        case pageSize
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        bulkSearchList = try container.decodeIfPresent(ArrayOfBulkSearchStatus.self, forKey: .bulkSearchList)
        currentPageNum = try container.decodeIfPresent(Int.self, forKey: .currentPageNum)
        maxPageNum = try container.decodeIfPresent(Int.self, forKey: .maxPageNum)
        totalBulkSearches = try container.decodeIfPresent(Int.self, forKey: .totalBulkSearches)
        pageSize = try container.decodeIfPresent(Int.self, forKey: .pageSize)
    }

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

public class BaseResponse : IBaseDataResponse, IHasResponseStatus, Codable
{
    /**
    * The status of the response
    */
    // @ApiMember(Description="The status of the response")
    public var responseStatus:ResponseStatus

    required public init(){}
}

public protocol IBaseDataResponse
{
    var responseStatus:ResponseStatus { get set }

}

public protocol IHasResponseStatus
{
    var responseStatus:ResponseStatus { get set }

}

public class BulkSearchStatus : Codable
{
    public var bulkSearchId:Int
    public var success:Bool
    public var status:String
    public var total:Int
    public var message:String
    public var processed:Int
    public var isPepSearch:Bool
    public var isSanctionsSearch:Bool
    public var totalPep:Int
    public var processedPep:Int
    public var totalSanctions:Int
    public var processedSanctions:Int

    required public init(){}
}

public class ArrayOfBulkSearchStatus : List<BulkSearchStatus>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class ArrayOfResponseError : List<ResponseError>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}