import { aU as axiosInstance } from "./index-DfebxkL9.js";
class StorageConfigurationService {
  /** Получить все конфигурации хранилищ **/
  async GetStorageConfigurations() {
    try {
      const {
        data
      } = await axiosInstance.get("/v1/StorageConfiguration");
      return data;
    } catch (e) {
      throw new Error(`Error getting storage configurations: ${e}`);
    }
  }
  /** Получить конфигурацию хранилища по ID **/
  async GetStorageConfigurationById(id) {
    try {
      const {
        data
      } = await axiosInstance.get(`/v1/StorageConfiguration/${id}`);
      return data;
    } catch (e) {
      throw new Error(`Error getting storage configuration by id: ${e}`);
    }
  }
  /** Создать новую конфигурацию хранилища **/
  async CreateStorageConfiguration(params) {
    try {
      const {
        data
      } = await axiosInstance.post("/v1/StorageConfiguration", params);
      return data;
    } catch (e) {
      throw new Error(`Error creating storage configuration: ${e}`);
    }
  }
  /** Изменить статус Enabled хранилища **/
  async SetStorageEnabled(params) {
    try {
      const {
        data
      } = await axiosInstance.put(`/v1/StorageConfiguration/${params.id}/Enabled?value=${params.value}`);
      return data;
    } catch (e) {
      throw new Error(`Error setting storage enabled status: ${e}`);
    }
  }
  /** Удалить конфигурацию хранилища **/
  async DeleteStorageConfiguration(params) {
    try {
      const {
        data
      } = await axiosInstance.delete(`/v1/StorageConfiguration?id=${params.id}`);
      return data;
    } catch (e) {
      throw new Error(`Error deleting storage configuration: ${e}`);
    }
  }
  /** Запустить миграцию данных между хранилищами **/
  async MigrateStorage(params) {
    try {
      const {
        data
      } = await axiosInstance.post(`/v1/StorageConfiguration/Migration/?from=${params.from}&to=${params.to}`);
      return data;
    } catch (e) {
      throw new Error(`Error migrating storage: ${e}`);
    }
  }
  /** Получить статус миграции **/
  async GetMigrationStatus(params) {
    try {
      const {
        data
      } = await axiosInstance.get(`/v1/StorageConfiguration/Migration/Status?id=${params.id}`);
      return data;
    } catch (e) {
      throw new Error(`Error getting migration status: ${e}`);
    }
  }
  /** Валидация конфигурации хранилища перед созданием **/
  async ValidateStorageConfiguration(params) {
    try {
      const {
        data
      } = await axiosInstance.post("/v1/StorageConfiguration/Validate", params);
      return data;
    } catch (e) {
      throw new Error(`Error validating storage configuration: ${e}`);
    }
  }
  /** Обновить конфигурацию хранилища **/
  async UpdateStorageConfiguration(params) {
    try {
      const {
        id,
        ...body
      } = params;
      const {
        data
      } = await axiosInstance.put(`/v1/StorageConfiguration/${id}`, body);
      return data;
    } catch (e) {
      throw new Error(`Error updating storage configuration: ${e}`);
    }
  }
  /** Отменить миграцию **/
  async CancelMigration(params) {
    try {
      await axiosInstance.post(`/v1/StorageConfiguration/Migration/Cancel?id=${params.id}`);
    } catch (e) {
      throw new Error(`Error canceling migration: ${e}`);
    }
  }
}
const storageConfigurationApiArea = () => new StorageConfigurationService();
export {
  storageConfigurationApiArea as s
};
//# sourceMappingURL=index-BVQ-Y7LP.js.map
