//
//  File.swift
//  WOKA
//
//  Created by MacBook Pro on 03/07/24.
//

import Foundation

// MARK: - ContinueAudioListDM
struct ContinueAudioListDM: Codable {
    let result: [ListenAudioListingDM.AudioDatum]?
    let totalRecords: Int?

    enum CodingKeys: String, CodingKey {
        case result
        case totalRecords = "total_records"
    }
    
    // MARK: - ResultData
    struct ResultData: Codable {
        let id: Int?
        let title, description: String?
        let thumbnailPath: String?
        let audioURL: String?
        let categoryMasterID, ageRangeMasterID, tagsKeyword, releaseDate: String?
        let languageMasterID: Int?
        let genderMasterID, audioDuration, mediaID: String?
        let contentMoreDetails: [ContentMoreDetail]?
        let userVideoView: [UserVideoView]?
        let showDataCount: Int?
        var markAsFavourite, isLiked: Bool?
        var viewsCount, likesCount, bookmarkCount: Int?

        enum CodingKeys: String, CodingKey {
            case id, title, description
            case thumbnailPath = "thumbnail_path"
            case audioURL = "audio_url"
            case categoryMasterID = "category_master_id"
            case ageRangeMasterID = "age_range_master_id"
            case tagsKeyword = "tags_keyword"
            case releaseDate = "release_date"
            case languageMasterID = "language_master_id"
            case genderMasterID = "gender_master_id"
            case audioDuration = "audio_duration"
            case mediaID = "media_id"
            case contentMoreDetails = "content_more_details"
            case userVideoView = "user_video_view"
            case showDataCount = "show_data_count"
            case markAsFavourite = "mark_as_favourite"
            case isLiked = "is_liked"
            case viewsCount = "views_count"
            case likesCount = "likes_count"
            case bookmarkCount = "bookmark_count"
        }
    }

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

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

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

