/* Options: Date: 2025-08-03 14:58:42 SwiftVersion: 5.0 Version: 6.110 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://szallitoiportal-be.veolia.hu //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: BrowseSupplier.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/supplier/{supplierid}", "GET") public class BrowseSupplier : IReturn, IGet, Codable { public typealias Return = BrowseSupplierResponse public var supplierId:Int required public init(){} } public class BrowseSupplierResponse : ResponseBase { public var supplier:SupplierDetails required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case supplier } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) supplier = try container.decodeIfPresent(SupplierDetails.self, forKey: .supplier) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if supplier != nil { try container.encode(supplier, forKey: .supplier) } } } public protocol IConcurrencyStamp { var concurrencyStamp:String { get set } } public class SupplierBase : ModifyRequestBase { public var vatNumber:String public var euTaxNumber:String public var groupTaxNumber:String public var businessType:Int public var countryId:Int public var name:String public var shortName:String public var registrationNumber:String public var establishedDate:Date public var registrationDate:Date public var duns:String public var operatingLicenseNumber:String public var isAccounting:Bool public var isSmallTaxPayer:Bool public var email:String public var phoneNumber:String public var website:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case vatNumber case euTaxNumber case groupTaxNumber case businessType case countryId case name case shortName case registrationNumber case establishedDate case registrationDate case duns case operatingLicenseNumber case isAccounting case isSmallTaxPayer case email case phoneNumber case website } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) vatNumber = try container.decodeIfPresent(String.self, forKey: .vatNumber) euTaxNumber = try container.decodeIfPresent(String.self, forKey: .euTaxNumber) groupTaxNumber = try container.decodeIfPresent(String.self, forKey: .groupTaxNumber) businessType = try container.decodeIfPresent(Int.self, forKey: .businessType) countryId = try container.decodeIfPresent(Int.self, forKey: .countryId) name = try container.decodeIfPresent(String.self, forKey: .name) shortName = try container.decodeIfPresent(String.self, forKey: .shortName) registrationNumber = try container.decodeIfPresent(String.self, forKey: .registrationNumber) establishedDate = try container.decodeIfPresent(Date.self, forKey: .establishedDate) registrationDate = try container.decodeIfPresent(Date.self, forKey: .registrationDate) duns = try container.decodeIfPresent(String.self, forKey: .duns) operatingLicenseNumber = try container.decodeIfPresent(String.self, forKey: .operatingLicenseNumber) isAccounting = try container.decodeIfPresent(Bool.self, forKey: .isAccounting) isSmallTaxPayer = try container.decodeIfPresent(Bool.self, forKey: .isSmallTaxPayer) email = try container.decodeIfPresent(String.self, forKey: .email) phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber) website = try container.decodeIfPresent(String.self, forKey: .website) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if vatNumber != nil { try container.encode(vatNumber, forKey: .vatNumber) } if euTaxNumber != nil { try container.encode(euTaxNumber, forKey: .euTaxNumber) } if groupTaxNumber != nil { try container.encode(groupTaxNumber, forKey: .groupTaxNumber) } if businessType != nil { try container.encode(businessType, forKey: .businessType) } if countryId != nil { try container.encode(countryId, forKey: .countryId) } if name != nil { try container.encode(name, forKey: .name) } if shortName != nil { try container.encode(shortName, forKey: .shortName) } if registrationNumber != nil { try container.encode(registrationNumber, forKey: .registrationNumber) } if establishedDate != nil { try container.encode(establishedDate, forKey: .establishedDate) } if registrationDate != nil { try container.encode(registrationDate, forKey: .registrationDate) } if duns != nil { try container.encode(duns, forKey: .duns) } if operatingLicenseNumber != nil { try container.encode(operatingLicenseNumber, forKey: .operatingLicenseNumber) } if isAccounting != nil { try container.encode(isAccounting, forKey: .isAccounting) } if isSmallTaxPayer != nil { try container.encode(isSmallTaxPayer, forKey: .isSmallTaxPayer) } if email != nil { try container.encode(email, forKey: .email) } if phoneNumber != nil { try container.encode(phoneNumber, forKey: .phoneNumber) } if website != nil { try container.encode(website, forKey: .website) } } } public enum SupplierStatus : Int, Codable { case Registered = 0 case AwaitingVeoliaConfirmation = 1 case Active = 2 case Rejected = 3 case Locked = 4 case Deleted = 5 } public class ResponseBase : Codable { public var responseStatus:ResponseStatus required public init(){} } public class SupplierDetails : SupplierBase { public var id:Int public var ownerId:Int public var countryName:String public var countryCode:String public var status:SupplierStatus public var meta:[String:String] = [:] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id case ownerId case countryName case countryCode case status case meta } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decodeIfPresent(Int.self, forKey: .id) ownerId = try container.decodeIfPresent(Int.self, forKey: .ownerId) countryName = try container.decodeIfPresent(String.self, forKey: .countryName) countryCode = try container.decodeIfPresent(String.self, forKey: .countryCode) status = try container.decodeIfPresent(SupplierStatus.self, forKey: .status) meta = try container.decodeIfPresent([String:String].self, forKey: .meta) ?? [:] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if id != nil { try container.encode(id, forKey: .id) } if ownerId != nil { try container.encode(ownerId, forKey: .ownerId) } if countryName != nil { try container.encode(countryName, forKey: .countryName) } if countryCode != nil { try container.encode(countryCode, forKey: .countryCode) } if status != nil { try container.encode(status, forKey: .status) } if meta.count > 0 { try container.encode(meta, forKey: .meta) } } } public class ModifyRequestBase : IConcurrencyStamp, Codable { public var concurrencyStamp:String required public init(){} }