//
//  CartListingDM.swift
//  WOKA
//
//  Created by MacBook Pro on 23/07/24.
//

import Foundation

// MARK: - CartListingDM
struct CartListingDM: Codable {
    let result: [ResultData]?
    let cartTotalAmount: String?
    let cartQuantity, totalRecords: Int?
    var totalAmount : Double
    let userType: String?
    let addressAvailable: Bool?

    enum CodingKeys: String, CodingKey {
        case result
        case cartTotalAmount = "cart_total_amount"
        case totalAmount = "total_amount"
        case cartQuantity = "cart_quantity"
        case totalRecords = "total_records"
        case userType = "user_type"
        case addressAvailable = "address_available"
    }
    
    
    // MARK: - Result
    struct ResultData: Codable {
        let id: Int?
        let skuID, productName: String?
        let categoryMasterID, subCategoryMasterID: Int?
        let productPrice: String?
        let remainStockQuantity: Int?
        let stockStatus: String?
//        let taxCategory: JSONNull?
        let taxValue: String?
        let productQuantity: Int?
        let shopMasterDetail: ShopMasterDetail?
        let shopImage: [String]?
        let productFinalPrice : Double?
        enum CodingKeys: String, CodingKey {
            case id
            case skuID = "sku_id"
            case productName = "product_name"
            case categoryMasterID = "category_master_id"
            case subCategoryMasterID = "sub_category_master_id"
            case productPrice = "product_price"
            case remainStockQuantity = "remain_stock_quantity"
            case stockStatus = "stock_status"
            case productFinalPrice = "product_final_price"
//            case taxCategory = "tax_category"
            case taxValue = "tax_value"
            case productQuantity = "product_quantity"
            case shopMasterDetail = "shop_master_detail"
            case shopImage = "shop_image"
        }
    }

    // MARK: - ShopMasterDetail
    struct ShopMasterDetail: Codable {
        let id, productID: Int?
        let productNameEnglish, productNameHindi, descriptionEnglish, descriptionHindi: String?

        enum CodingKeys: String, CodingKey {
            case id
            case productID = "product_id"
            case productNameEnglish = "product_name_english"
            case productNameHindi = "product_name_hindi"
            case descriptionEnglish = "description_english"
            case descriptionHindi = "description_hindi"
        }
    }
}
