//
//  LNOrderResponse.swift
//  Lanu
//
//  Created by OneeChan on 2025/11/18.
//

import Foundation
import AutoCodable


enum LNOrderStatus: Int, Decodable {
    case created = 0
    case waitingForAccept = 1
    case completed = 2
    case refunded = 3
    case accepted = 4
    case rejected = 5
    case servicing = 6
    case serviceDone = 7
    case cancelled = 8
}

enum LNOrderSource: Int, Decodable {
    case normal = 1
    case custom = 2
}

@AutoCodable
class LNCreateOrderResponse: Decodable {
    var orderNo: String = ""
    var goldCoinBalance: Int = 0
}

@AutoCodable
class LNOrderListItemVO: Decodable {
    var orderId: String = ""
    var avatar: String = ""
    var nickname: String = ""
    var bizCategoryName: String = ""
    var categoryIcon: String = ""
    var price: Double = 0
    var unit: String = ""
    var purchaseQty: Int = 0
    var status: LNOrderStatus = .created
    var createTime: Int = 0
    var star: Double = 0
    var refundApply: Bool = false
    var customerRemark: String = ""
    var gender: LNUserGender = .unknow
    var totalAmount: Double = 0
    var sellerUserNo: String = ""
}

@AutoCodable
class LNOrderListResponse: Decodable {
    var list: [LNOrderListItemVO] = []
    var next: String = ""
}

@AutoCodable
class LNOrderInfoVO: Decodable {
    var orderId: String = ""
    var avatar: String = ""
    var nickname: String = ""
    var bizCategoryName: String = ""
    var categoryIcon: String = ""
    var price: Double = 0
    var unit: String = ""
    var purchaseQty: Int = 0
    var status: LNOrderStatus = .created
    var createTime: Int = 0
    var star: Double = 0.0
    var refundApply: Bool = false
    var customerRemark: String = ""
    var gender: LNUserGender = .unknow
    var totalAmount: Double = 0
    
    init () { }
}

@AutoCodable
class LNOrderAttachmentVO: Decodable {
    var attachmentUrl: String = ""
}

@AutoCodable
class LNOrderDetailResponse: Decodable {
    var orderInfo: LNOrderInfoVO = LNOrderInfoVO()
    var reason: String = ""
    var attachments: [LNOrderAttachmentVO] = []
    var playmateReason: String = ""
    var playmateAttachments: [LNOrderAttachmentVO] = []
}

@AutoCodable
class LNCreateOrderQRCodeResponse: Decodable {
    var qrCode: String = ""
}

@AutoCodable
class LNOrderRecordItemVO: Decodable {
    var orderId: String = ""
    var avatar: String = ""
    var nickname: String = ""
    var bizCategoryName: String = ""
    var categoryIcon: String = ""
    var price: Double = 0
    var unit: String = ""
    var purchaseQty: Int = 0
    var status: LNOrderStatus = .created
    var createTime: Int = 0
    var star: Double = 0
    var refundApply: Bool = false
    var customerRemark: String = ""
    var gender: LNUserGender = .unknow
    var totalAmount: Double = 0
    var buyerUserNo: String = ""
}

@AutoCodable
class LNOrderRecordListResponse: Decodable {
    var list: [LNOrderRecordItemVO] = []
    var next: String = ""
}

@AutoCodable
class LNUnfinishedOrderVO: Decodable, LNOrderProtocol {
    var orderId: String = ""
    var avatar: String = ""
    var nickname: String = ""
    var bizCategoryName: String = ""
    var categoryIcon: String = ""
    var price: Double = 0
    var unit: String = ""
    var purchaseQty: Int = 0
    var status: LNOrderStatus = .created
    var createTime: Int = 0
    var star: Double = 0
    var refundApply: Bool = false
    var customerRemark: String = ""
    var gender: LNUserGender = .unknow
    var hasCredentials: Bool = false
    var buyerUserNo: String = ""
}

@AutoCodable
class LNUnfinishedOrderListResponse: Decodable {
    var list: [LNUnfinishedOrderVO] = []
    var next: String = ""
}

@AutoCodable
class LNQRCodeDetailResponse: Decodable {
    var qrCode: String = ""
    var avatar: String = ""
    var nickname: String = ""
    var bizCategoryName: String = ""
    var bizCategoryIcon: String = ""
    var price: Double = 0
    var unit: String = ""
    var purchaseQty: Int = 0
    var goldCoinAmount: Double = 0
    var type: LNOrderSource = .normal
    var star: Double = 0
    var currencyAmount: Double = 0
    var sellerUserNo: String = ""
}

@AutoCodable
class LNLastOrderResponse: Decodable {
    var avatar: String = ""
    var nickname: String = ""
    var finishTime: Int = 0
    var bizCateGoryName: String = ""
}

@AutoCodable
class LNOrderDiscountVO: Decodable {
    var hasChance: Bool = false
    var discountRate: Double = 0
    var eligiblePrice: Double = 0
}
