/* Options: Date: 2024-11-21 11:48:40 SwiftVersion: 5.0 Version: 8.23 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://api.bokamera.se //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: UpdateEaccountingCustomer.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/eaccounting/customers", "PUT") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class UpdateEaccountingCustomer : IReturn, ICompany, Codable { public typealias Return = EAccountingCustomerResponse /** * Customer Id in e-accounting. */ // @ApiMember(Description="Customer Id in e-accounting.", IsRequired=true) public var id:String /** * */ // @ApiMember(Description="") public var invoiceCity:String /** * Max length: 10 characters */ // @ApiMember(Description="Max length: 10 characters") public var invoicePostalCode:String /** * Max length: 50 characters */ // @ApiMember(Description="Max length: 50 characters") public var name:String /** * */ // @ApiMember(Description="") public var termsOfPaymentId:String /** * */ // @ApiMember(Description="") public var isPrivatePerson:Bool /** * */ // @ApiMember(Description="") public var isActive:Bool /** * */ // @ApiMember(Description="") public var telephone:String /** * */ // @ApiMember(Description="") public var emailAddress:String /** * */ // @ApiMember(Description="") public var mobilePhone:String /** * 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? required public init(){} } public class EAccountingCustomerResponse : CreateEAccountingCustomer { public var id:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decodeIfPresent(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 id != nil { try container.encode(id, forKey: .id) } } } public protocol ICompany { var companyId:String? { get set } } public class InvoiceAddress : Codable { 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 EAccountingTermsOfPayment : Codable { public var id:String public var name:String public var nameEnglish:String public var numberOfDays:Int public var termsOfPaymentTypeId:Int public var termsOfPaymentTypeText:String public var availableForSales:Bool public var availableForPurchase:Bool required public init(){} } public class CustomerLabel : Codable { public var id:String public var name:String public var Description:String required public init(){} } public class DirectDebitCustomerSettings : Codable { public var mandateId:String public var mandateType:Int public var sequenceType:Int public var signingDate:Date public var endDate:Date public var latestDirectDebit:Date required public init(){} } public class CreateEAccountingCustomer : InvoiceAddress { public var customerNumber:String public var contactPersonEmail:String public var contactPersonMobile:String public var contactPersonName:String public var contactPersonPhone:String public var currencyCode:String public var gln:String public var emailAddress:String public var emailAddressOrder:String public var emailAddressQuote:String public var deliveryCustomerName:String public var deliveryAddress1:String public var deliveryAddress2:String public var deliveryCity:String public var deliveryCountryCode:String public var deliveryPostalCode:String public var deliveryMethodId:String public var deliveryTermId:String public var payToAccountId:String public var name:String public var note:String public var reverseChargeOnConstructionServices:Bool public var webshopCustomerNumber:Int? public var mobilePhone:String public var telephone:String public var termsOfPaymentId:String public var eAccountingTermsOfPayment:EAccountingTermsOfPayment public var vatNumber:String public var wwwAddress:String public var lastInvoiceDate:String public var isPrivatePerson:Bool public var isNorthernIreland:Bool public var discountPercentage:Double public var changedUtc:Date? public var isActive:Bool public var forceBookkeepVat:Bool public var ediGlnNumber:String public var salesDocumentLanguage:String public var electronicAddress:String public var electronicReference:String public var ediServiceDelivererId:String public var autoInvoiceActivationEmailSentDate:Date? public var autoInvoiceRegistrationRequestSentDate:Date? public var emailAddresses:[String] = [] public var customerLabels:[CustomerLabel] = [] public var messageThreads:[String] = [] public var notes:[String] = [] public var isFutureInvoiceDateAllowed:Bool public var deliveryBasedVat:Bool public var salesPriceListId:String public var iban:String public var directDebitCustomerSettings:DirectDebitCustomerSettings public var discountAgreementId:String public var unpaidInvoicesAmount:Double required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case customerNumber case contactPersonEmail case contactPersonMobile case contactPersonName case contactPersonPhone case currencyCode case gln case emailAddress case emailAddressOrder case emailAddressQuote case deliveryCustomerName case deliveryAddress1 case deliveryAddress2 case deliveryCity case deliveryCountryCode case deliveryPostalCode case deliveryMethodId case deliveryTermId case payToAccountId case name case note case reverseChargeOnConstructionServices case webshopCustomerNumber case mobilePhone case telephone case termsOfPaymentId case eAccountingTermsOfPayment case vatNumber case wwwAddress case lastInvoiceDate case isPrivatePerson case isNorthernIreland case discountPercentage case changedUtc case isActive case forceBookkeepVat case ediGlnNumber case salesDocumentLanguage case electronicAddress case electronicReference case ediServiceDelivererId case autoInvoiceActivationEmailSentDate case autoInvoiceRegistrationRequestSentDate case emailAddresses case customerLabels case messageThreads case notes case isFutureInvoiceDateAllowed case deliveryBasedVat case salesPriceListId case iban case directDebitCustomerSettings case discountAgreementId case unpaidInvoicesAmount } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) customerNumber = try container.decodeIfPresent(String.self, forKey: .customerNumber) contactPersonEmail = try container.decodeIfPresent(String.self, forKey: .contactPersonEmail) contactPersonMobile = try container.decodeIfPresent(String.self, forKey: .contactPersonMobile) contactPersonName = try container.decodeIfPresent(String.self, forKey: .contactPersonName) contactPersonPhone = try container.decodeIfPresent(String.self, forKey: .contactPersonPhone) currencyCode = try container.decodeIfPresent(String.self, forKey: .currencyCode) gln = try container.decodeIfPresent(String.self, forKey: .gln) emailAddress = try container.decodeIfPresent(String.self, forKey: .emailAddress) emailAddressOrder = try container.decodeIfPresent(String.self, forKey: .emailAddressOrder) emailAddressQuote = try container.decodeIfPresent(String.self, forKey: .emailAddressQuote) deliveryCustomerName = try container.decodeIfPresent(String.self, forKey: .deliveryCustomerName) deliveryAddress1 = try container.decodeIfPresent(String.self, forKey: .deliveryAddress1) deliveryAddress2 = try container.decodeIfPresent(String.self, forKey: .deliveryAddress2) deliveryCity = try container.decodeIfPresent(String.self, forKey: .deliveryCity) deliveryCountryCode = try container.decodeIfPresent(String.self, forKey: .deliveryCountryCode) deliveryPostalCode = try container.decodeIfPresent(String.self, forKey: .deliveryPostalCode) deliveryMethodId = try container.decodeIfPresent(String.self, forKey: .deliveryMethodId) deliveryTermId = try container.decodeIfPresent(String.self, forKey: .deliveryTermId) payToAccountId = try container.decodeIfPresent(String.self, forKey: .payToAccountId) name = try container.decodeIfPresent(String.self, forKey: .name) note = try container.decodeIfPresent(String.self, forKey: .note) reverseChargeOnConstructionServices = try container.decodeIfPresent(Bool.self, forKey: .reverseChargeOnConstructionServices) webshopCustomerNumber = try container.decodeIfPresent(Int.self, forKey: .webshopCustomerNumber) mobilePhone = try container.decodeIfPresent(String.self, forKey: .mobilePhone) telephone = try container.decodeIfPresent(String.self, forKey: .telephone) termsOfPaymentId = try container.decodeIfPresent(String.self, forKey: .termsOfPaymentId) eAccountingTermsOfPayment = try container.decodeIfPresent(EAccountingTermsOfPayment.self, forKey: .eAccountingTermsOfPayment) vatNumber = try container.decodeIfPresent(String.self, forKey: .vatNumber) wwwAddress = try container.decodeIfPresent(String.self, forKey: .wwwAddress) lastInvoiceDate = try container.decodeIfPresent(String.self, forKey: .lastInvoiceDate) isPrivatePerson = try container.decodeIfPresent(Bool.self, forKey: .isPrivatePerson) isNorthernIreland = try container.decodeIfPresent(Bool.self, forKey: .isNorthernIreland) discountPercentage = try container.decodeIfPresent(Double.self, forKey: .discountPercentage) changedUtc = try container.decodeIfPresent(Date.self, forKey: .changedUtc) isActive = try container.decodeIfPresent(Bool.self, forKey: .isActive) forceBookkeepVat = try container.decodeIfPresent(Bool.self, forKey: .forceBookkeepVat) ediGlnNumber = try container.decodeIfPresent(String.self, forKey: .ediGlnNumber) salesDocumentLanguage = try container.decodeIfPresent(String.self, forKey: .salesDocumentLanguage) electronicAddress = try container.decodeIfPresent(String.self, forKey: .electronicAddress) electronicReference = try container.decodeIfPresent(String.self, forKey: .electronicReference) ediServiceDelivererId = try container.decodeIfPresent(String.self, forKey: .ediServiceDelivererId) autoInvoiceActivationEmailSentDate = try container.decodeIfPresent(Date.self, forKey: .autoInvoiceActivationEmailSentDate) autoInvoiceRegistrationRequestSentDate = try container.decodeIfPresent(Date.self, forKey: .autoInvoiceRegistrationRequestSentDate) emailAddresses = try container.decodeIfPresent([String].self, forKey: .emailAddresses) ?? [] customerLabels = try container.decodeIfPresent([CustomerLabel].self, forKey: .customerLabels) ?? [] messageThreads = try container.decodeIfPresent([String].self, forKey: .messageThreads) ?? [] notes = try container.decodeIfPresent([String].self, forKey: .notes) ?? [] isFutureInvoiceDateAllowed = try container.decodeIfPresent(Bool.self, forKey: .isFutureInvoiceDateAllowed) deliveryBasedVat = try container.decodeIfPresent(Bool.self, forKey: .deliveryBasedVat) salesPriceListId = try container.decodeIfPresent(String.self, forKey: .salesPriceListId) iban = try container.decodeIfPresent(String.self, forKey: .iban) directDebitCustomerSettings = try container.decodeIfPresent(DirectDebitCustomerSettings.self, forKey: .directDebitCustomerSettings) discountAgreementId = try container.decodeIfPresent(String.self, forKey: .discountAgreementId) unpaidInvoicesAmount = try container.decodeIfPresent(Double.self, forKey: .unpaidInvoicesAmount) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if customerNumber != nil { try container.encode(customerNumber, forKey: .customerNumber) } if contactPersonEmail != nil { try container.encode(contactPersonEmail, forKey: .contactPersonEmail) } if contactPersonMobile != nil { try container.encode(contactPersonMobile, forKey: .contactPersonMobile) } if contactPersonName != nil { try container.encode(contactPersonName, forKey: .contactPersonName) } if contactPersonPhone != nil { try container.encode(contactPersonPhone, forKey: .contactPersonPhone) } if currencyCode != nil { try container.encode(currencyCode, forKey: .currencyCode) } if gln != nil { try container.encode(gln, forKey: .gln) } if emailAddress != nil { try container.encode(emailAddress, forKey: .emailAddress) } if emailAddressOrder != nil { try container.encode(emailAddressOrder, forKey: .emailAddressOrder) } if emailAddressQuote != nil { try container.encode(emailAddressQuote, forKey: .emailAddressQuote) } if deliveryCustomerName != nil { try container.encode(deliveryCustomerName, forKey: .deliveryCustomerName) } if deliveryAddress1 != nil { try container.encode(deliveryAddress1, forKey: .deliveryAddress1) } if deliveryAddress2 != nil { try container.encode(deliveryAddress2, forKey: .deliveryAddress2) } if deliveryCity != nil { try container.encode(deliveryCity, forKey: .deliveryCity) } if deliveryCountryCode != nil { try container.encode(deliveryCountryCode, forKey: .deliveryCountryCode) } if deliveryPostalCode != nil { try container.encode(deliveryPostalCode, forKey: .deliveryPostalCode) } if deliveryMethodId != nil { try container.encode(deliveryMethodId, forKey: .deliveryMethodId) } if deliveryTermId != nil { try container.encode(deliveryTermId, forKey: .deliveryTermId) } if payToAccountId != nil { try container.encode(payToAccountId, forKey: .payToAccountId) } if name != nil { try container.encode(name, forKey: .name) } if note != nil { try container.encode(note, forKey: .note) } if reverseChargeOnConstructionServices != nil { try container.encode(reverseChargeOnConstructionServices, forKey: .reverseChargeOnConstructionServices) } if webshopCustomerNumber != nil { try container.encode(webshopCustomerNumber, forKey: .webshopCustomerNumber) } if mobilePhone != nil { try container.encode(mobilePhone, forKey: .mobilePhone) } if telephone != nil { try container.encode(telephone, forKey: .telephone) } if termsOfPaymentId != nil { try container.encode(termsOfPaymentId, forKey: .termsOfPaymentId) } if eAccountingTermsOfPayment != nil { try container.encode(eAccountingTermsOfPayment, forKey: .eAccountingTermsOfPayment) } if vatNumber != nil { try container.encode(vatNumber, forKey: .vatNumber) } if wwwAddress != nil { try container.encode(wwwAddress, forKey: .wwwAddress) } if lastInvoiceDate != nil { try container.encode(lastInvoiceDate, forKey: .lastInvoiceDate) } if isPrivatePerson != nil { try container.encode(isPrivatePerson, forKey: .isPrivatePerson) } if isNorthernIreland != nil { try container.encode(isNorthernIreland, forKey: .isNorthernIreland) } if discountPercentage != nil { try container.encode(discountPercentage, forKey: .discountPercentage) } if changedUtc != nil { try container.encode(changedUtc, forKey: .changedUtc) } if isActive != nil { try container.encode(isActive, forKey: .isActive) } if forceBookkeepVat != nil { try container.encode(forceBookkeepVat, forKey: .forceBookkeepVat) } if ediGlnNumber != nil { try container.encode(ediGlnNumber, forKey: .ediGlnNumber) } if salesDocumentLanguage != nil { try container.encode(salesDocumentLanguage, forKey: .salesDocumentLanguage) } if electronicAddress != nil { try container.encode(electronicAddress, forKey: .electronicAddress) } if electronicReference != nil { try container.encode(electronicReference, forKey: .electronicReference) } if ediServiceDelivererId != nil { try container.encode(ediServiceDelivererId, forKey: .ediServiceDelivererId) } if autoInvoiceActivationEmailSentDate != nil { try container.encode(autoInvoiceActivationEmailSentDate, forKey: .autoInvoiceActivationEmailSentDate) } if autoInvoiceRegistrationRequestSentDate != nil { try container.encode(autoInvoiceRegistrationRequestSentDate, forKey: .autoInvoiceRegistrationRequestSentDate) } if emailAddresses.count > 0 { try container.encode(emailAddresses, forKey: .emailAddresses) } if customerLabels.count > 0 { try container.encode(customerLabels, forKey: .customerLabels) } if messageThreads.count > 0 { try container.encode(messageThreads, forKey: .messageThreads) } if notes.count > 0 { try container.encode(notes, forKey: .notes) } if isFutureInvoiceDateAllowed != nil { try container.encode(isFutureInvoiceDateAllowed, forKey: .isFutureInvoiceDateAllowed) } if deliveryBasedVat != nil { try container.encode(deliveryBasedVat, forKey: .deliveryBasedVat) } if salesPriceListId != nil { try container.encode(salesPriceListId, forKey: .salesPriceListId) } if iban != nil { try container.encode(iban, forKey: .iban) } if directDebitCustomerSettings != nil { try container.encode(directDebitCustomerSettings, forKey: .directDebitCustomerSettings) } if discountAgreementId != nil { try container.encode(discountAgreementId, forKey: .discountAgreementId) } if unpaidInvoicesAmount != nil { try container.encode(unpaidInvoicesAmount, forKey: .unpaidInvoicesAmount) } } }