//
//  AdsDM.swift
//  WOKA
//
//  Created by MacBook Pro on 04/09/24.
//

import Foundation

// MARK: - AdsDM
struct AdsDM: Codable {
    let result: [Result]?
    let totalRecords: Int?

    enum CodingKeys: String, CodingKey {
        case result
        case totalRecords = "total_records"
    }
    
    // MARK: - Result
    struct Result: Codable {
        let id: Int?
        let pageName, slug, isActive: String?
        let advertisement: Advertisement?
        let googleAd: GoogleAd?

        enum CodingKeys: String, CodingKey {
            case id
            case pageName = "page_name"
            case slug
            case isActive = "is_active"
            case advertisement
            case googleAd = "google_ad"
        }
    }

    // MARK: - Advertisement
    struct Advertisement: Codable {
        let id, adPagesXid: Int?
        let title, adCompany: String?
        let bannerImage, buttonImage: String?
        let forPage: String?
        let adLink: String?
        let isActive: String?

        enum CodingKeys: String, CodingKey {
            case id
            case adPagesXid = "ad_pages_xid"
            case title
            case adCompany = "ad_company"
            case bannerImage = "banner_image"
            case buttonImage = "button_image"
            case forPage = "for_page"
            case adLink = "ad_link"
            case isActive = "is_active"
        }
    }

    // MARK: - GoogleAd
    struct GoogleAd: Codable {
        let id, adPagesXid: Int?
        let isActive: String?

        enum CodingKeys: String, CodingKey {
            case id
            case adPagesXid = "ad_pages_xid"
            case isActive = "is_active"
        }
    }
}


//// MARK: - AdsDM
//struct AdsDM: 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 title, adCompany: String?
//        let bannerImage, buttonImage: String?
//        let forPage: String?
//        let adLink: String?
//
//        enum CodingKeys: String, CodingKey {
//            case id, title
//            case adCompany = "ad_company"
//            case bannerImage = "banner_image"
//            case buttonImage = "button_image"
//            case forPage = "for_page"
//            case adLink = "ad_link"
//        }
//    }
//}
