

import APIClient
import ComposableArchitecture
import FeatureOnboardingScreens
import SwiftUI

@Reducer
public struct DemoOnboardingNotificationsQuestion {
    @ObservableState
    public struct State: Equatable {
        var notificationQuestion = OnboardingNotificationsQuestion.State(me: .init(
            models: [],
            roles: [:],
            flags: [:],
            user: .empty()
        ))

        public init() {}
    }

    public enum Action {
        case task
        case onAppear
        case dismiss
        case notificationQuestion(OnboardingNotificationsQuestion.Action)
    }

    public init() {}

    public var body: some ReducerOf<Self> {
        Scope(state: \.notificationQuestion, action: \.notificationQuestion) {
            OnboardingNotificationsQuestion()
        }
        Reduce<State, Action> { _, action in
            switch action {
            case .onAppear:
                return .none
            case .notificationQuestion(.delegate(let delegateAction)):
                return .none
            case .task:
                return .none
            case .dismiss:
                return .none
            case .notificationQuestion:
                return .none
            }
        }
    }
}

public struct DemoOnboardingNotificationsQuestionView: View {
    let store: StoreOf<DemoOnboardingNotificationsQuestion>
    @Environment(\.scenePhase) var scenePhase

    public init(store: StoreOf<DemoOnboardingNotificationsQuestion>) {
        self.store = store
    }

    public var body: some View {
        VStack(spacing: .zero) {
            DemoTitleHeaderBar(
                title: "Onboarding Create",
                onBackAction: {
                    store.send(.dismiss)
                }
            )
            OnboardingNotificationsQuestionScreen(store: store.scope(
                state: \.notificationQuestion,
                action: \.notificationQuestion
            ))
        }
        .task {
            store.send(.task)
        }
        .onAppear {
            store.send(.onAppear)
        }
    }
}
