//
//  EpisodeListingDM.swift
//  WOKA
//
//  Created by Bilal on 21/06/2024.
//

import Foundation

import Foundation

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

    enum CodingKeys: String, CodingKey {
        case result
        case totalRecords = "total_records"
    }
    
    
    // MARK: - Result
    struct ResultData: Codable {
        let id, watchShowsMasterID, seasonMasterID, episodeNumber: Int?
        let episodeTitle, episodeDescription: String?
        let thumbnailPath: String?
        let thumbnailImgURL: String?
        let episodeURL: String?
        let languageMasterID: Int?
        let tagsKeyword, episodeDuration: String?
        let releaseDate: String?
        let contentMoreDetails: [ContentMoreDetail]?
        let seasonData: SeasonData?
        let userVideoView: [UserVideoView]?

        enum CodingKeys: String, CodingKey {
            case id
            case watchShowsMasterID = "watch_shows_master_id"
            case seasonMasterID = "season_master_id"
            case episodeNumber = "episode_number"
            case episodeTitle = "episode_title"
            case episodeDescription = "episode_description"
            case thumbnailPath = "thumbnail_path"
            case thumbnailImgURL = "thumbnail_img_url"
            case episodeURL = "episode_url"
            case languageMasterID = "language_master_id"
            case tagsKeyword = "tags_keyword"
            case episodeDuration = "episode_duration"
            case releaseDate = "release_date"
            case contentMoreDetails = "content_more_details"
            case seasonData = "season_data"
            case userVideoView = "user_video_view"
        }
    }
    
    // MARK: - UserVideoView
    struct UserVideoView: Codable {
        let id, userID, postID, postType: Int?
        let totalWatchedDuration, lastWatchedLeft: String?
        let categoryID: Int?

        enum CodingKeys: String, CodingKey {
            case id
            case userID = "user_id"
            case postID = "post_id"
            case postType = "post_type"
            case totalWatchedDuration = "total_watched_duration"
            case lastWatchedLeft = "last_watched_left"
            case categoryID = "category_id"
        }
    }
    

    // MARK: - ContentMoreDetail
    struct ContentMoreDetail: Codable {
        let id, contentID, postType, languageMasterID: Int?
        let title, description, tagsKeywords: String?
        let contentHDURL, contentSDURL: 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 contentHDURL = "content_hd_url"
            case contentSDURL = "content_sd_url"
        }
    }

    // MARK: - SeasonData
    struct SeasonData: Codable {
        let id, watchShowsMasterID: Int?
        let seasonNumber: String?

        enum CodingKeys: String, CodingKey {
            case id
            case watchShowsMasterID = "watch_shows_master_id"
            case seasonNumber = "season_number"
        }
    }

}
