/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { OperationalState } from "#clusters/operational-state";
import { RvcOperationalState } from "#clusters/rvc-operational-state";
var OperationalStateUtils;
((OperationalStateUtils2) => {
  function assertPause(currentState) {
    if (currentState === OperationalState.OperationalStateEnum.Stopped || currentState === OperationalState.OperationalStateEnum.Error) {
      return {
        commandResponseState: {
          errorStateId: OperationalState.ErrorState.CommandInvalidInState
        }
      };
    }
    return {
      commandResponseState: {
        errorStateId: OperationalState.ErrorState.NoError
      }
    };
  }
  OperationalStateUtils2.assertPause = assertPause;
  function assertRvcPause(currentState) {
    const result = assertPause(currentState);
    if (result.commandResponseState.errorStateId === OperationalState.ErrorState.NoError) {
      if (currentState === RvcOperationalState.OperationalState.Charging || currentState === RvcOperationalState.OperationalState.Docked) {
        return {
          commandResponseState: {
            errorStateId: OperationalState.ErrorState.CommandInvalidInState
          }
        };
      }
    }
    return result;
  }
  OperationalStateUtils2.assertRvcPause = assertRvcPause;
  function assertResume(currentState) {
    if (currentState === OperationalState.OperationalStateEnum.Stopped || currentState === OperationalState.OperationalStateEnum.Error) {
      return {
        commandResponseState: {
          errorStateId: OperationalState.ErrorState.CommandInvalidInState
        }
      };
    }
    return {
      commandResponseState: {
        errorStateId: OperationalState.ErrorState.NoError
      }
    };
  }
  OperationalStateUtils2.assertResume = assertResume;
  function assertRvcResume(currentState) {
    const result = assertResume(currentState);
    if (result.commandResponseState.errorStateId === OperationalState.ErrorState.NoError) {
      if (currentState === RvcOperationalState.OperationalState.SeekingCharger) {
        return {
          commandResponseState: {
            errorStateId: OperationalState.ErrorState.CommandInvalidInState
          }
        };
      }
    }
    return result;
  }
  OperationalStateUtils2.assertRvcResume = assertRvcResume;
  function assertRvcGoHome(currentState) {
    if (currentState === RvcOperationalState.OperationalState.Docked || currentState === RvcOperationalState.OperationalState.Charging) {
      return {
        commandResponseState: {
          errorStateId: OperationalState.ErrorState.CommandInvalidInState
        }
      };
    }
    return {
      commandResponseState: {
        errorStateId: OperationalState.ErrorState.NoError
      }
    };
  }
  OperationalStateUtils2.assertRvcGoHome = assertRvcGoHome;
})(OperationalStateUtils || (OperationalStateUtils = {}));
export {
  OperationalStateUtils
};
//# sourceMappingURL=OperationalStateUtils.js.map
