/* Options: Date: 2025-12-06 13:08:06 SwiftVersion: 5.0 Version: 6.110 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://etc-api.vsmlab.vn //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: ApprovedRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/DocumentPolicy/Approved", "POST") public class ApprovedRequest : IReturn, IPost, Codable { public typealias Return = ApprovedResponse public var id:Int public var isApproved:Bool? public var approvalComment:String required public init(){} } public class ApprovedResponse : IResponseRequest, Codable { public var updatedData:DocumentPolicy public var code:Int public var message:String required public init(){} } public protocol IResponseRequest { var code:Int { get set } var message:String { get set } } public class DocumentPolicy : UpdateDocumentPolicyModel { public var approvedDate:Date? public var estimatedDeadline:Date? public var isApproved:Bool // @Required() public var createdBy:Int? public var createdDate:Date public var deletedAt:Date? public var deletedBy:Int? public var approvalComment:String public var isDeleted:Bool? public var lastUpdateAt:Date? public var updatedBy:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case approvedDate case estimatedDeadline case isApproved case createdBy case createdDate case deletedAt case deletedBy case approvalComment case isDeleted case lastUpdateAt case updatedBy } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) approvedDate = try container.decodeIfPresent(Date.self, forKey: .approvedDate) estimatedDeadline = try container.decodeIfPresent(Date.self, forKey: .estimatedDeadline) isApproved = try container.decodeIfPresent(Bool.self, forKey: .isApproved) createdBy = try container.decodeIfPresent(Int.self, forKey: .createdBy) createdDate = try container.decodeIfPresent(Date.self, forKey: .createdDate) deletedAt = try container.decodeIfPresent(Date.self, forKey: .deletedAt) deletedBy = try container.decodeIfPresent(Int.self, forKey: .deletedBy) approvalComment = try container.decodeIfPresent(String.self, forKey: .approvalComment) isDeleted = try container.decodeIfPresent(Bool.self, forKey: .isDeleted) lastUpdateAt = try container.decodeIfPresent(Date.self, forKey: .lastUpdateAt) updatedBy = try container.decodeIfPresent(Int.self, forKey: .updatedBy) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if approvedDate != nil { try container.encode(approvedDate, forKey: .approvedDate) } if estimatedDeadline != nil { try container.encode(estimatedDeadline, forKey: .estimatedDeadline) } if isApproved != nil { try container.encode(isApproved, forKey: .isApproved) } if createdBy != nil { try container.encode(createdBy, forKey: .createdBy) } if createdDate != nil { try container.encode(createdDate, forKey: .createdDate) } if deletedAt != nil { try container.encode(deletedAt, forKey: .deletedAt) } if deletedBy != nil { try container.encode(deletedBy, forKey: .deletedBy) } if approvalComment != nil { try container.encode(approvalComment, forKey: .approvalComment) } if isDeleted != nil { try container.encode(isDeleted, forKey: .isDeleted) } if lastUpdateAt != nil { try container.encode(lastUpdateAt, forKey: .lastUpdateAt) } if updatedBy != nil { try container.encode(updatedBy, forKey: .updatedBy) } } }