//
//  GamesListDM.swift
//  WOKA
//
//  Created by MacBook Pro on 04/07/24.
//

import Foundation

enum ScreenOrientation: String, Codable {
    case landscape = "Landscape"
    case portrait = "Portrait"
}
// MARK: - GamesListDM
struct GamesListDM: Codable {
    let gameData: [GameDatum]?
    let totalRecords: Int?

    enum CodingKeys: String, CodingKey {
        case gameData = "game_data"
        case totalRecords = "total_records"
    }
    
    // MARK: - GameDatum
    struct GameDatum: Codable {
        let id: Int?
        let title, description: String?
        let gameURL: String?
        let screenOrientation: ScreenOrientation?
        let thumbnailPath: String?
        let categoryMasterID, ageRangeMasterID: String?
        let releaseDate: String?
        let languageMasterID: Int?
        let genderMasterID: String?
        let contentMoreDetails: [ContentMoreDetail]?
//        let categoryData, ageRangeData, genderData: [JSONAny]?
        var markAsFavourite, isLiked: Bool?
        var likesCount, bookmarkCount: Int?

        enum CodingKeys: String, CodingKey {
            case id, title, description
            case gameURL = "game_url"
            case screenOrientation = "screen_orientation"
            case thumbnailPath = "thumbnail_path"
            case categoryMasterID = "category_master_id"
            case ageRangeMasterID = "age_range_master_id"
            case releaseDate = "release_date"
            case languageMasterID = "language_master_id"
            case genderMasterID = "gender_master_id"
            case contentMoreDetails = "content_more_details"
//            case categoryData = "category_data"
//            case ageRangeData = "age_range_data"
//            case genderData = "gender_data"
            case markAsFavourite = "mark_as_favourite"
            case isLiked = "is_liked"
            case likesCount = "likes_count"
            case bookmarkCount = "bookmark_count"
        }
    }

    // MARK: - ContentMoreDetail
    struct ContentMoreDetail: Codable {
        let id, contentID, postType, languageMasterID: Int?
        let title, description, tagsKeywords: String?
        let url: String?

        enum CodingKeys: String, CodingKey {
            case id
            case contentID = "content_id"
            case postType = "post_type"
            case languageMasterID = "language_master_id"
            case title, description
            case tagsKeywords = "tags_keywords"
            case url
        }
    }

}
