import { isDocumentAction, createReducer } from "document-model";
import { vetraCloudEnvironmentDataManagementOperations } from "../src/reducers/data-management.js";
import { vetraCloudEnvironmentServicesOperations } from "../src/reducers/services.js";
import { vetraCloudEnvironmentPackagesOperations } from "../src/reducers/packages.js";
import { vetraCloudEnvironmentStatusTransitionsOperations } from "../src/reducers/status-transitions.js";
import { SetLabelInputSchema, SetGenericSubdomainInputSchema, SetCustomDomainInputSchema, SetDefaultPackageRegistryInputSchema, SetDnsRecordsInputSchema, EnableServiceInputSchema, DisableServiceInputSchema, ToggleServiceInputSchema, UpdateServicePrefixInputSchema, SetServiceStatusInputSchema, SetServiceVersionInputSchema, AddPackageInputSchema, RemovePackageInputSchema, SetPackageVersionInputSchema, InitializeInputSchema, MarkChangesPushedInputSchema, MarkDeploymentStartedInputSchema, ReportDeploymentSucceededInputSchema, ReportDeploymentFailedInputSchema, ApproveChangesInputSchema, TerminateEnvironmentInputSchema, MarkDestroyedInputSchema, ArchiveInputSchema, UnarchiveInputSchema, } from "./schema/zod.js";
const stateReducer = (state, action, dispatch) => {
    if (isDocumentAction(action)) {
        return state;
    }
    switch (action.type) {
        case "SET_LABEL": {
            SetLabelInputSchema().parse(action.input);
            vetraCloudEnvironmentDataManagementOperations.setLabelOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_GENERIC_SUBDOMAIN": {
            SetGenericSubdomainInputSchema().parse(action.input);
            vetraCloudEnvironmentDataManagementOperations.setGenericSubdomainOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_CUSTOM_DOMAIN": {
            SetCustomDomainInputSchema().parse(action.input);
            vetraCloudEnvironmentDataManagementOperations.setCustomDomainOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_DEFAULT_PACKAGE_REGISTRY": {
            SetDefaultPackageRegistryInputSchema().parse(action.input);
            vetraCloudEnvironmentDataManagementOperations.setDefaultPackageRegistryOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_DNS_RECORDS": {
            SetDnsRecordsInputSchema().parse(action.input);
            vetraCloudEnvironmentDataManagementOperations.setDnsRecordsOperation(state[action.scope], action, dispatch);
            break;
        }
        case "ENABLE_SERVICE": {
            EnableServiceInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.enableServiceOperation(state[action.scope], action, dispatch);
            break;
        }
        case "DISABLE_SERVICE": {
            DisableServiceInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.disableServiceOperation(state[action.scope], action, dispatch);
            break;
        }
        case "TOGGLE_SERVICE": {
            ToggleServiceInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.toggleServiceOperation(state[action.scope], action, dispatch);
            break;
        }
        case "UPDATE_SERVICE_PREFIX": {
            UpdateServicePrefixInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.updateServicePrefixOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_SERVICE_STATUS": {
            SetServiceStatusInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.setServiceStatusOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_SERVICE_VERSION": {
            SetServiceVersionInputSchema().parse(action.input);
            vetraCloudEnvironmentServicesOperations.setServiceVersionOperation(state[action.scope], action, dispatch);
            break;
        }
        case "ADD_PACKAGE": {
            AddPackageInputSchema().parse(action.input);
            vetraCloudEnvironmentPackagesOperations.addPackageOperation(state[action.scope], action, dispatch);
            break;
        }
        case "REMOVE_PACKAGE": {
            RemovePackageInputSchema().parse(action.input);
            vetraCloudEnvironmentPackagesOperations.removePackageOperation(state[action.scope], action, dispatch);
            break;
        }
        case "SET_PACKAGE_VERSION": {
            SetPackageVersionInputSchema().parse(action.input);
            vetraCloudEnvironmentPackagesOperations.setPackageVersionOperation(state[action.scope], action, dispatch);
            break;
        }
        case "INITIALIZE": {
            InitializeInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.initializeOperation(state[action.scope], action, dispatch);
            break;
        }
        case "MARK_CHANGES_PUSHED": {
            MarkChangesPushedInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.markChangesPushedOperation(state[action.scope], action, dispatch);
            break;
        }
        case "MARK_DEPLOYMENT_STARTED": {
            MarkDeploymentStartedInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.markDeploymentStartedOperation(state[action.scope], action, dispatch);
            break;
        }
        case "REPORT_DEPLOYMENT_SUCCEEDED": {
            ReportDeploymentSucceededInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.reportDeploymentSucceededOperation(state[action.scope], action, dispatch);
            break;
        }
        case "REPORT_DEPLOYMENT_FAILED": {
            ReportDeploymentFailedInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.reportDeploymentFailedOperation(state[action.scope], action, dispatch);
            break;
        }
        case "APPROVE_CHANGES": {
            ApproveChangesInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.approveChangesOperation(state[action.scope], action, dispatch);
            break;
        }
        case "TERMINATE_ENVIRONMENT": {
            TerminateEnvironmentInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.terminateEnvironmentOperation(state[action.scope], action, dispatch);
            break;
        }
        case "MARK_DESTROYED": {
            MarkDestroyedInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.markDestroyedOperation(state[action.scope], action, dispatch);
            break;
        }
        case "ARCHIVE": {
            ArchiveInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.archiveOperation(state[action.scope], action, dispatch);
            break;
        }
        case "UNARCHIVE": {
            UnarchiveInputSchema().parse(action.input);
            vetraCloudEnvironmentStatusTransitionsOperations.unarchiveOperation(state[action.scope], action, dispatch);
            break;
        }
        default:
            return state;
    }
};
export const reducer = createReducer(stateReducer);
