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

import SwiftUI

struct ContentMainOriginalAudioDramaView: View {
    
    let itemList: [SeriesListItem]
    let onClickMore: () -> Void
    
    var body: some View {
        VStack(spacing: 13.3) {
            HStack(spacing: 0) {
                Text("오리지널 오디오 드라마")
                    .font(.custom(Font.bold.rawValue, size: 18.3))
                    .foregroundColor(.grayee)
                
                Spacer()
                
                Image("ic_forward")
                    .onTapGesture { onClickMore() }
            }
            .padding(.horizontal, 13.3)
            
            ScrollView(.horizontal, showsIndicators: false) {
                HStack(spacing: 13.3) {
                    ForEach(0..<itemList.count, id: \.self) { index in
                        let item = itemList[index]
                        
                        ContentMainOriginalAudioDramaItemView(
                            itemWidth: 150,
                            item: item,
                            isAll: false
                        )
                    }
                }
                .padding(.horizontal, 13.3)
            }
        }
    }
}

#Preview {
    ContentMainOriginalAudioDramaView(
        itemList: [
            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: false,
                isPopular: true
            ),
            SeriesListItem(
                seriesId: 2,
                title: "제목2",
                coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
                publishedDaysOfWeek: "랜덤",
                isComplete: false,
                creator: SeriesListItemCreator(
                    creatorId: 1,
                    nickname: "creator",
                    profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
                ),
                numberOfContent: 10,
                isNew: true,
                isPopular: false
            )
        ]
    ) {}
}
