```jsno
{
"success": {
"tmts": [
{
"type": "TMTS",
"category": "connected_services",
"code": null,
"status": 111,
"validity": {
"start": 1655164800,
"end": 1655769600
},
"is_extensible": false,
"title": "Telemaintenance",
"status_reason": "WIT",
"subscriptionTechCreationDate": "2022-06-14T13:12:55.000Z"
}
],
"remoteLev": [
{
"type": "REMOTELEV",
"category": "connected_services",
"code": null,
"status": 104,
"validity": {
"start": 1656547200,
"end": 1657065600
},
"is_extensible": false,
"title": "e-Commandes à distance",
"status_reason": "NID",
"subscriptionTechCreationDate": "2022-06-30T04:00:11.000Z",
"associationId": "50477743-5e22-412b-ae3c-95a882df781a",
"fds": [
"NCG01",
"NBM01",
"NAS01",
"NAO02"
]
}
],
"raccess": [
{
"type": "RACCESS",
"category": "connected_services",
"code": null,
"status": 104,
"validity": {
"start": 1656547200,
"end": 1657065600
},
"is_extensible": false,
"title": "COMMANDES A DISTANCE",
"status_reason": "NID",
"subscriptionTechCreationDate": "2022-06-30T03:55:51.000Z",
"associationId": "dac6a286-f703-45d1-a696-7c4b266f5405",
"fds": [
"NEE02",
"NEF02",
"NEF01"
]
}
],
"nac": [
{
"type": "NAVCOZAR",
"category": "connected_services",
"code": null,
"status": 2,
"validity": {
"start": 1656979200,
"end": 1751673600
},
"is_extensible": false,
"title": "Pack Navigation connectée",
"status_reason": "",
"subscriptionTechCreationDate": "2022-07-05T14:15:04.000Z"
},
{
"type": "NAVCO",
"category": "connected_services",
"code": null,
"status": 111,
"validity": {
"start": 1576800000,
"end": 1673222400
},
"is_extensible": null,
"title": null,
"status_reason": "",
"subscriptionTechCreationDate": ""
}
],
"bta": [
{
"type": "DEX BTA",
"status": 0,
"level": 0
}
],
"services": [],
"club": []
}
}
```
```swift
//
// ContractResponseBO.swift
// MyMarque
//
// Created by Srinivas Rao Kurakula on 15/04/21.
// Copyright © 2021 PSA. All rights reserved.
//
import Foundation
@objcMembers
class ContractResponseBO: NSObject, Codable {
var nac: [UserContractBO]?
var tmts: [UserContractBO]?
var bta: [UserContractBO]?
var services: [UserContractBO]?
var club: [UserContractBO]?
var remoteLev: [UserContractBO]?
var raccess: [UserContractBO]?
var dscp: [UserContractBO]?
var flexiLease: [UserContractBO]?
}
@objc
enum ContractStatus: Int {
case standBy = 1
case active
case suspended
case terminated
case canceled = 6
case terminatedForLoss
case terminatedExpired
case terminatedStandByTime = 12
case pendingActivation = 101
case pendingIdentification = 102
case pendingCreation = 103
case deactivated = 111
}
@objcMembers
class UserContractBO: NSObject, Codable, NSCopying {
var type: String?
var code: String?
var status: Int32?
var level: Int32?
var isExtensible: Bool?
var serviceTitle: String?
var category: String?
var validity: ContractValidity?
var associationID: String?
var fds: [String]?
var label : String?
var products: [String]?
var secureCode: String?
var contractStartDate: Date? = nil
var contractEndDate: Date? = nil
var vin: String? = nil
var userEmail: String? = nil
var statusReason: String?
enum CodingKeys: String, CodingKey {
case type, status, level, code, category, validity, fds, label, products
case isExtensible = "is_extensible"
case secureCode = "secure_code"
case serviceTitle = "title"
case associationID = "associationId"
case statusReason = "status_reason"
}
func copy(with zone: NSZone? = nil) -> Any {
let copy = UserContractBO()
copy.type = self.type
copy.code = self.code
copy.status = self.status
copy.level = self.level
copy.isExtensible = self.isExtensible
copy.serviceTitle = self.serviceTitle
copy.category = self.category
copy.validity = self.validity
copy.associationID = self.associationID
copy.fds = self.fds
copy.label = self.label
copy.products = self.products
copy.secureCode = self.secureCode
copy.contractStartDate = self.contractStartDate
copy.contractEndDate = self.contractEndDate
copy.vin = self.vin
copy.userEmail = self.userEmail
copy.statusReason = self.statusReason
return copy
}
/*
Below functions are added because Objective-c doesn't support optional primitive values
*/
func setStatus(_ status: Int32) {
self.status = status
}
func getStatus() -> Int32 {
return status ?? 0
}
func setExtensibleContract(_ isExtensible: Bool) {
self.isExtensible = isExtensible
}
func isExtensibleContract() -> Bool {
return isExtensible ?? false
}
func setLevel(_ level: Int32) {
self.level = level
}
func getLevel() -> Int32 {
return level ?? 0
}
func areDatesValid() -> Bool {
guard let startDate = contractStartDate, let endDate = contractEndDate else {
return false
}
let startTimeInterval = startDate.timeIntervalSinceNow
let endTimeInterval = endDate.timeIntervalSinceNow
return startTimeInterval <= 0 && endTimeInterval >= 0
}
}
class ContractValidity: NSObject, Codable {
var start: Double?
var end: Double?
}
enum SatusReason: String {
case ota = "OTA"
case none = ""
}
```




