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

import Foundation

// MARK: - CouponListDM
struct CouponListDM: 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 couponCode: String?
        let categoryMasterID, usageLimit, discountType: Int?
        let discountValue, startFrom, endDate: String?
        let category: Category?

        enum CodingKeys: String, CodingKey {
            case id
            case couponCode = "coupon_code"
            case categoryMasterID = "category_master_id"
            case usageLimit = "usage_limit"
            case discountType = "discount_type"
            case discountValue = "discount_value"
            case startFrom = "start_from"
            case endDate = "end_date"
            case category
        }
    }

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

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