//
//  ScenicPromotionFullStateView.swift
//  suixinkan
//
//  Created by Codex on 2026/7/2.
//

import SwiftUI

/// 宣传页 Empty / Error 通用状态视图。
struct ScenicPromotionFullStateView: View {
    let icon: String
    let title: String
    let message: String
    let buttonTitle: String
    let action: () -> Void

    var body: some View {
        VStack(spacing: 18) {
            Spacer()

            Image(systemName: icon)
                .font(.system(size: 48, weight: .semibold))
                .foregroundStyle(Color(hex: 0x0B79FF))
                .frame(width: 92, height: 92)
                .background(.white.opacity(0.75), in: RoundedRectangle(cornerRadius: 24))

            VStack(spacing: 8) {
                Text(title)
                    .font(.system(size: 22, weight: .bold))
                    .foregroundStyle(Color(hex: 0x143D78))
                Text(message)
                    .font(.system(size: 14, weight: .medium))
                    .foregroundStyle(Color(hex: 0x5F789E))
                    .multilineTextAlignment(.center)
            }

            Button(action: action) {
                Text(buttonTitle)
                    .font(.system(size: 16, weight: .bold))
                    .foregroundStyle(.white)
                    .frame(width: 150, height: 46)
                    .background(Color(hex: 0x0B79FF), in: Capsule())
            }
            .buttonStyle(.plain)

            Spacer()
        }
        .padding(28)
    }
}

#if DEBUG
#Preview("空数据") {
    ZStack {
        ScenicPromotionSkyBackground().ignoresSafeArea()
        ScenicPromotionFullStateView(
            icon: "doc.text.image",
            title: "暂无宣传页数据",
            message: "当前景区还没有配置排队导览宣传内容",
            buttonTitle: "重新加载"
        ) {}
    }
}
#endif
