/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CreateUserAddressDto } from "../models/CreateUserAddressDto";
import type { UpdateUserAddressDto } from "../models/UpdateUserAddressDto";
import type { CancelablePromise } from "../core/CancelablePromise";
import { OpenAPI } from "../core/OpenAPI";
import { request as __request } from "../core/request";
export class AddressesService {
  /**
   * @param type
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerGetDefaultAddresses(
    type: string = "any",
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/user-addresses/defaults",
      query: {
        type: type,
      },
    });
  }
  /**
   * @param requestBody
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerAddNewAddress(
    requestBody: CreateUserAddressDto,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/user-addresses",
      body: requestBody,
      mediaType: "application/json",
    });
  }
  /**
   * @param addressType
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerGetAllActiveUserAddresses(
    addressType: string,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/user-addresses/{addressType}",
      path: {
        addressType: addressType,
      },
    });
  }
  /**
   * @param id
   * @param requestBody
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerUpdateAddress(
    id: number,
    requestBody: UpdateUserAddressDto,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "PATCH",
      url: "/v1/user-addresses/{id}",
      path: {
        id: id,
      },
      body: requestBody,
      mediaType: "application/json",
    });
  }
  /**
   * @param id
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerDeleteAddress(
    id: number,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/v1/user-addresses/{id}",
      path: {
        id: id,
      },
    });
  }
  /**
   * @param addressType
   * @param addressId
   * @returns any
   * @throws ApiError
   */
  public static userAddressesControllerSetAddressAsDefault(
    addressType: string,
    addressId: number,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "PATCH",
      url: "/v1/user-addresses/{addressType}/{addressId}/default",
      path: {
        addressType: addressType,
        addressId: addressId,
      },
    });
  }
  /**
   * @returns any
   * @throws ApiError
   */
  public static addressesControllerGetCountries(): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/addresses/countries",
    });
  }
  /**
   * @param countryId
   * @returns any
   * @throws ApiError
   */
  public static addressesControllerGetSates(
    countryId: number,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/addresses/states",
      query: {
        countryId: countryId,
      },
      isServerAction: true,
    });
  }
  /**
   * @param countryId
   * @param stateId
   * @returns any
   * @throws ApiError
   */
  public static addressesControllerGetCities(
    countryId: number,
    stateId?: number,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/addresses/cities",
      query: {
        stateId: stateId,
        countryId: countryId,
      },
      isServerAction: true,
    });
  }
}
