//
//  ContentMainSeriesCurationView.swift
//  SodaLive
//
//  Created by klaus on 2/21/25.
//

import SwiftUI

struct ContentMainSeriesCurationView: View {
    
    let curationList: [GetSeriesCurationResponse]
    
    var body: some View {
        LazyVStack(spacing: 30) {
            ForEach(0..<curationList.count, id: \.self) { index in
                let curation = curationList[index]
                ContentMainSeriesCurationItemView(curation: curation)
            }
        }
    }
}

struct ContentMainSeriesCurationItemView: View {
    
    let curation: GetSeriesCurationResponse
    
    var body: some View {
        VStack(alignment: .leading, spacing: 13.3) {
            Text(curation.title)
                .font(.custom(Font.bold.rawValue, size: 18.3))
                .foregroundColor(.grayee)
                .padding(.horizontal, 13.3)
            
            ScrollView(.horizontal, showsIndicators: false) {
                HStack(spacing: 13.3) {
                    ForEach(0..<curation.items.count, id: \.self) { index in
                        let item = curation.items[index]
                        SeriesListBigItemView(item: item, isVisibleCreator: true)
                    }
                }
                .padding(.horizontal, 13.3)
            }
        }
    }
}

#Preview {
    ContentMainSeriesCurationView(
        curationList: [
            GetSeriesCurationResponse(
                title: "test",
                items: [
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    ),
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    )
                ]
            ),
            GetSeriesCurationResponse(
                title: "test2",
                items: [
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    ),
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    )
                ]
            ),
            GetSeriesCurationResponse(
                title: "test3",
                items: [
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    ),
                    SeriesListItem(
                        seriesId: 1,
                        title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
                        coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                        publishedDaysOfWeek: "매주 수, 토요일",
                        isComplete: true,
                        creator: SeriesListItemCreator(
                            creatorId: 1,
                            nickname: "creator",
                            profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                        ),
                        numberOfContent: 10,
                        isNew: true,
                        isPopular: true
                    )
                ]
            )
        ]
    )
}
