/* Options: Date: 2025-12-06 13:06:47 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: SearchDocumentPolicyRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/DocumentPolicy", "GET") public class SearchDocumentPolicyRequest : DocumentPolicyFilter, IReturn, IGet { public typealias Return = DocumentPolicyResponse 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 DocumentPolicyResponse : IResponseRequest, Codable { public var code:Int public var message:String public var documentPolicy:[DocumentPolicy] = [] public var unapprovedCount:Int public var totalCount:Int required public init(){} } public class PagingRequest : Codable { public var page:Int public var limit:Int required public init(){} } public class DocumentPolicyFilter : PagingRequest { public var departmentId:Int? public var name:String public var isApproved:Bool? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case departmentId case name case isApproved } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) departmentId = try container.decodeIfPresent(Int.self, forKey: .departmentId) name = try container.decodeIfPresent(String.self, forKey: .name) isApproved = try container.decodeIfPresent(Bool.self, forKey: .isApproved) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if departmentId != nil { try container.encode(departmentId, forKey: .departmentId) } if name != nil { try container.encode(name, forKey: .name) } if isApproved != nil { try container.encode(isApproved, forKey: .isApproved) } } } 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) } } }