122 lines
3.2 KiB
Swift
122 lines
3.2 KiB
Swift
// MARK: - Blind Box Models
|
|
import Foundation
|
|
|
|
// MARK: - Blind Box Media Type
|
|
enum BlindBoxMediaType {
|
|
case video
|
|
case image
|
|
case all
|
|
}
|
|
|
|
// MARK: - Blind Box Animation Phase
|
|
enum BlindBoxAnimationPhase {
|
|
case loading
|
|
case ready
|
|
case opening
|
|
case none
|
|
}
|
|
|
|
// MARK: - Blind Box Data Models
|
|
|
|
struct BlindList: Codable, Identifiable {
|
|
let id: Int64
|
|
let boxCode: String
|
|
let userId: Int64
|
|
let name: String
|
|
let boxType: String
|
|
let features: String?
|
|
let resultFileId: Int64?
|
|
let status: String
|
|
let workflowInstanceId: String?
|
|
let videoGenerateTime: String?
|
|
let createTime: String
|
|
let coverFileId: Int64?
|
|
let description: String
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case id
|
|
case boxCode = "box_code"
|
|
case userId = "user_id"
|
|
case name
|
|
case boxType = "box_type"
|
|
case features
|
|
case resultFileId = "result_file_id"
|
|
case status
|
|
case workflowInstanceId = "workflow_instance_id"
|
|
case videoGenerateTime = "video_generate_time"
|
|
case createTime = "create_time"
|
|
case coverFileId = "cover_file_id"
|
|
case description
|
|
}
|
|
}
|
|
|
|
struct BlindCount: Codable {
|
|
let availableQuantity: Int
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case availableQuantity = "available_quantity"
|
|
}
|
|
}
|
|
|
|
struct BlindBoxData: Codable {
|
|
let id: Int64
|
|
let boxCode: String
|
|
let userId: Int64
|
|
let name: String
|
|
let boxType: String
|
|
let features: String?
|
|
let url: String?
|
|
let status: String
|
|
let workflowInstanceId: String?
|
|
let videoGenerateTime: String?
|
|
let createTime: String
|
|
let description: String?
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case id
|
|
case boxCode = "box_code"
|
|
case userId = "user_id"
|
|
case name
|
|
case boxType = "box_type"
|
|
case features
|
|
case url
|
|
case status
|
|
case workflowInstanceId = "workflow_instance_id"
|
|
case videoGenerateTime = "video_generate_time"
|
|
case createTime = "create_time"
|
|
case description
|
|
}
|
|
|
|
init(id: Int64, boxCode: String, userId: Int64, name: String, boxType: String, features: String?, url: String?, status: String, workflowInstanceId: String?, videoGenerateTime: String?, createTime: String, description: String?) {
|
|
self.id = id
|
|
self.boxCode = boxCode
|
|
self.userId = userId
|
|
self.name = name
|
|
self.boxType = boxType
|
|
self.features = features
|
|
self.url = url
|
|
self.status = status
|
|
self.workflowInstanceId = workflowInstanceId
|
|
self.videoGenerateTime = videoGenerateTime
|
|
self.createTime = createTime
|
|
self.description = description
|
|
}
|
|
|
|
init(from listItem: BlindList) {
|
|
self.init(
|
|
id: listItem.id,
|
|
boxCode: listItem.boxCode,
|
|
userId: listItem.userId,
|
|
name: listItem.name,
|
|
boxType: listItem.boxType,
|
|
features: listItem.features,
|
|
url: nil,
|
|
status: listItem.status,
|
|
workflowInstanceId: listItem.workflowInstanceId,
|
|
videoGenerateTime: listItem.videoGenerateTime,
|
|
createTime: listItem.createTime,
|
|
description: listItem.description
|
|
)
|
|
}
|
|
}
|