//
//  ShopProductsListingDM.swift
//  WOKA
//
//  Created by MacBook Pro on 22/07/24.
//

import Foundation

// MARK: - ShopProductsListingDM
struct ShopProductsListingDM: Codable {
    let result: [ResultData]?
    let totalRecords: Int?

    enum CodingKeys: String, CodingKey {
        case result
        case totalRecords = "total_records"
    }
    
    // MARK: - Result
    struct ResultData: Codable {
        let id: Int?
        let skuID, productName, productThumbnail: String?
        let categoryMasterID, subCategoryMasterID: Int?
        let productPrice: String?
        let remainStockQuantity: Int?
        let stockStatus: String?
//        let taxCategory: JSONNull?
        let taxValue: String?
        let shopMasterDetail: CartListingDM.ShopMasterDetail?
        let shopImage: [String]?
        var addedToCart: Bool?
        let productFinalPrice : Double?
        let category : Category?
        enum CodingKeys: String, CodingKey {
            case id, category
            case skuID = "sku_id"
            case productName = "product_name"
            case productThumbnail = "product_thumbnail"
            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 taxCategory = "tax_category"
            case taxValue = "tax_value"
            case shopMasterDetail = "shop_master_detail"
            case shopImage = "shop_image"
            case addedToCart = "added_to_cart"
            case productFinalPrice = "product_final_price"
        }
    }
    
    // MARK: - Category
    struct Category: Codable {
        let id: Int?
        let categoryName: String?

        enum CodingKeys: String, CodingKey {
            case id
            case categoryName = "category_name"
        }
    }


    // 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"
        }
    }
}

/*
// MARK: - AddressListDMElement
struct AddressListDMElement: 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 shopMasterDetail: ShopMasterDetail?
    let shopImage: [String]?
    let category: Category?
    let addedToCart: Bool?

    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 taxCategory = "tax_category"
        case taxValue = "tax_value"
        case shopMasterDetail = "shop_master_detail"
        case shopImage = "shop_image"
        case category
        case addedToCart = "added_to_cart"
    }
}

// MARK: - Category
struct Category: Codable {
    let id: Int?
    let categoryName: String?

    enum CodingKeys: String, CodingKey {
        case id
        case categoryName = "category_name"
    }
}

// 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"
    }
}

*/
