import APIClient
import ComponentLibrary
import ComposableArchitecture
import Foundation
import Localization

@Reducer
public struct OnboardingNotificationsQuestion {
    @ObservableState
    public struct State: Equatable {
        /*
            Onboarding screens in V1 seem to just hang on to me to pass it along
            Just matching that pattern here might not need it for V2
         */
        public var me: Me

        public init(me: Me) {
            self.me = me
        }
    }

    public enum Action: BindableAction {
        @CasePathable
        @dynamicMemberLookup
        public enum Delegate {
            case onAppear
            case showNotification(_ me: Me)
            case tappedBack
            case tappedSkip(_ me: Me)
        }

        case onAppear
        case tappedShowNotification
        case tappedBack
        case tappedSkip

        case binding(BindingAction<State>)
        case delegate(Delegate)
    }

    public init() {}

    public var body: some ReducerOf<Self> {
        BindingReducer()

        Reduce { state, action in
            switch action {
            case .onAppear:
                return .send(.delegate(.onAppear))

            case .tappedShowNotification:
                return .send(.delegate(.showNotification(state.me)))

            case .tappedSkip:
                return .send(.delegate(.tappedSkip(state.me)))

            case .tappedBack:
                return .none

            case .binding:
                return .none

            case .delegate:
                return .none
            }
        }
    }
}
