//
//  MPPositive_JsonSearchTypeContinuation.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/5/14.
//

import UIKit
///搜索分类结果继续结构
struct JsonSearchTypeContinuation: Codable {
    let continuationContents:ContinuationContents?
    enum CodingKeys: String, CodingKey {
        case continuationContents = "continuationContents"
    }
    init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
        continuationContents = try values.decodeIfPresent(ContinuationContents.self, forKey: .continuationContents)
    }
    struct ContinuationContents: Codable {
        let musicShelfContinuation:MusicShelfContinuation?
        enum CodingKeys: String, CodingKey {
            case musicShelfContinuation = "musicShelfContinuation"
        }
        init(from decoder: Decoder) throws {
            let values = try decoder.container(keyedBy: CodingKeys.self)
            musicShelfContinuation = try values.decodeIfPresent(MusicShelfContinuation.self, forKey: .musicShelfContinuation)
        }
        struct MusicShelfContinuation: Codable {
            ///内容块
            let contents:[Content]?
            ///继续请求块
            let continuations:[Continuation]?
            enum CodingKeys: String, CodingKey {
                case contents = "contents"
                case continuations = "continuations"
            }
            init(from decoder: Decoder) throws {
                let values = try decoder.container(keyedBy: CodingKeys.self)
                contents = try values.decodeIfPresent([Content].self, forKey: .contents)
                continuations = try values.decodeIfPresent([Continuation].self, forKey: .continuations)
            }
            ///内容块
            struct Content: Codable {
                let musicResponsiveListItemRenderer:RootMusicResponsiveListItemRenderer?
                
                enum CodingKeys: String, CodingKey {
                    case musicResponsiveListItemRenderer = "musicResponsiveListItemRenderer"
                }
                init(from decoder: Decoder) throws {
                    let values = try decoder.container(keyedBy: CodingKeys.self)
                    musicResponsiveListItemRenderer = try values.decodeIfPresent(RootMusicResponsiveListItemRenderer.self, forKey: .musicResponsiveListItemRenderer)
                }
            }
            ///继续请求块
            struct Continuation: Codable {
                let nextContinuationData:NextContinuationData?
                enum CodingKeys: String, CodingKey {
                    case nextContinuationData = "nextContinuationData"
                }
                init(from decoder: Decoder) throws {
                    let values = try decoder.container(keyedBy: CodingKeys.self)
                    nextContinuationData = try values.decodeIfPresent(NextContinuationData.self, forKey: .nextContinuationData)
                }
                struct NextContinuationData: Codable {
                    ///继续请求编码
                    let continuation:String?
                    ///继续请求参数
                    let clickTrackingParams:String?
                    enum CodingKeys: String, CodingKey {
                        case continuation = "continuation"
                        case clickTrackingParams = "clickTrackingParams"
                    }
                    init(from decoder: Decoder) throws {
                        let values = try decoder.container(keyedBy: CodingKeys.self)
                        continuation = try values.decodeIfPresent(String.self, forKey: .continuation)
                        clickTrackingParams = try values.decodeIfPresent(String.self, forKey: .clickTrackingParams)
                    }
                }
            }
        }
    }
}
