// This file is auto-generated by @hey-api/openapi-ts

import type { CancelablePromise } from "./core/CancelablePromise"
import { OpenAPI } from "./core/OpenAPI"
import { request as __request } from "./core/request"
import type {
  ItemsReadItemsData,
  ItemsReadItemsResponse,
  ItemsCreateItemData,
  ItemsCreateItemResponse,
  ItemsReadItemData,
  ItemsReadItemResponse,
  ItemsUpdateItemData,
  ItemsUpdateItemResponse,
  ItemsDeleteItemData,
  ItemsDeleteItemResponse,
  LoginLoginAccessTokenData,
  LoginLoginAccessTokenResponse,
  LoginTestTokenResponse,
  LoginRecoverPasswordData,
  LoginRecoverPasswordResponse,
  LoginResetPasswordData,
  LoginResetPasswordResponse,
  LoginRecoverPasswordHtmlContentData,
  LoginRecoverPasswordHtmlContentResponse,
  PrivateCreateUserData,
  PrivateCreateUserResponse,
  UsersReadUsersData,
  UsersReadUsersResponse,
  UsersCreateUserData,
  UsersCreateUserResponse,
  UsersReadUserMeResponse,
  UsersDeleteUserMeResponse,
  UsersUpdateUserMeData,
  UsersUpdateUserMeResponse,
  UsersUpdatePasswordMeData,
  UsersUpdatePasswordMeResponse,
  UsersRegisterUserData,
  UsersRegisterUserResponse,
  UsersReadUserByIdData,
  UsersReadUserByIdResponse,
  UsersUpdateUserData,
  UsersUpdateUserResponse,
  UsersDeleteUserData,
  UsersDeleteUserResponse,
  UtilsTestEmailData,
  UtilsTestEmailResponse,
  UtilsHealthCheckResponse,
  WeatherGetTwoHourForecastData,
  WeatherGetTwoHourForecastResponse,
  WeatherGetAirTemperatureData,
  WeatherGetAirTemperatureResponse,
  WeatherGetWindDirectionData,
  WeatherGetWindDirectionResponse,
  WeatherGetLightningData,
  WeatherGetLightningResponse,
  WeatherGetWbgtData,
  WeatherGetWbgtResponse,
  WeatherGetTwentyFourHourForecastData,
  WeatherGetTwentyFourHourForecastResponse,
  WeatherGetFourDayOutlookData,
  WeatherGetFourDayOutlookResponse,
} from "./types.gen"

export class ItemsService {
  /**
   * Read Items
   * Retrieve items.
   * @param data The data for the request.
   * @param data.skip
   * @param data.limit
   * @returns ItemsPublic Successful Response
   * @throws ApiError
   */
  public static readItems(
    data: ItemsReadItemsData = {},
  ): CancelablePromise<ItemsReadItemsResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/items/",
      query: {
        skip: data.skip,
        limit: data.limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Create Item
   * Create new item.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns ItemPublic Successful Response
   * @throws ApiError
   */
  public static createItem(
    data: ItemsCreateItemData,
  ): CancelablePromise<ItemsCreateItemResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/items/",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Read Item
   * Get item by ID.
   * @param data The data for the request.
   * @param data.id
   * @returns ItemPublic Successful Response
   * @throws ApiError
   */
  public static readItem(
    data: ItemsReadItemData,
  ): CancelablePromise<ItemsReadItemResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/items/{id}",
      path: {
        id: data.id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Update Item
   * Update an item.
   * @param data The data for the request.
   * @param data.id
   * @param data.requestBody
   * @returns ItemPublic Successful Response
   * @throws ApiError
   */
  public static updateItem(
    data: ItemsUpdateItemData,
  ): CancelablePromise<ItemsUpdateItemResponse> {
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/items/{id}",
      path: {
        id: data.id,
      },
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Delete Item
   * Delete an item.
   * @param data The data for the request.
   * @param data.id
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static deleteItem(
    data: ItemsDeleteItemData,
  ): CancelablePromise<ItemsDeleteItemResponse> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/items/{id}",
      path: {
        id: data.id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class LoginService {
  /**
   * Login Access Token
   * OAuth2 compatible token login, get an access token for future requests
   * @param data The data for the request.
   * @param data.formData
   * @returns Token Successful Response
   * @throws ApiError
   */
  public static loginAccessToken(
    data: LoginLoginAccessTokenData,
  ): CancelablePromise<LoginLoginAccessTokenResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/login/access-token",
      formData: data.formData,
      mediaType: "application/x-www-form-urlencoded",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Test Token
   * Test access token
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static testToken(): CancelablePromise<LoginTestTokenResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/login/test-token",
    })
  }

  /**
   * Recover Password
   * Password Recovery
   * @param data The data for the request.
   * @param data.email
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static recoverPassword(
    data: LoginRecoverPasswordData,
  ): CancelablePromise<LoginRecoverPasswordResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/password-recovery/{email}",
      path: {
        email: data.email,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Reset Password
   * Reset password
   * @param data The data for the request.
   * @param data.requestBody
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static resetPassword(
    data: LoginResetPasswordData,
  ): CancelablePromise<LoginResetPasswordResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/reset-password/",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Recover Password Html Content
   * HTML Content for Password Recovery
   * @param data The data for the request.
   * @param data.email
   * @returns string Successful Response
   * @throws ApiError
   */
  public static recoverPasswordHtmlContent(
    data: LoginRecoverPasswordHtmlContentData,
  ): CancelablePromise<LoginRecoverPasswordHtmlContentResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/password-recovery-html-content/{email}",
      path: {
        email: data.email,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class PrivateService {
  /**
   * Create User
   * Create a new user.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static createUser(
    data: PrivateCreateUserData,
  ): CancelablePromise<PrivateCreateUserResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/private/users/",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class UsersService {
  /**
   * Read Users
   * Retrieve users.
   * @param data The data for the request.
   * @param data.skip
   * @param data.limit
   * @returns UsersPublic Successful Response
   * @throws ApiError
   */
  public static readUsers(
    data: UsersReadUsersData = {},
  ): CancelablePromise<UsersReadUsersResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/users/",
      query: {
        skip: data.skip,
        limit: data.limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Create User
   * Create new user.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static createUser(
    data: UsersCreateUserData,
  ): CancelablePromise<UsersCreateUserResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/users/",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Read User Me
   * Get current user.
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static readUserMe(): CancelablePromise<UsersReadUserMeResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/users/me",
    })
  }

  /**
   * Delete User Me
   * Delete own user.
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static deleteUserMe(): CancelablePromise<UsersDeleteUserMeResponse> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/users/me",
    })
  }

  /**
   * Update User Me
   * Update own user.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static updateUserMe(
    data: UsersUpdateUserMeData,
  ): CancelablePromise<UsersUpdateUserMeResponse> {
    return __request(OpenAPI, {
      method: "PATCH",
      url: "/api/v1/users/me",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Update Password Me
   * Update own password.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static updatePasswordMe(
    data: UsersUpdatePasswordMeData,
  ): CancelablePromise<UsersUpdatePasswordMeResponse> {
    return __request(OpenAPI, {
      method: "PATCH",
      url: "/api/v1/users/me/password",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Register User
   * Create new user without the need to be logged in.
   * @param data The data for the request.
   * @param data.requestBody
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static registerUser(
    data: UsersRegisterUserData,
  ): CancelablePromise<UsersRegisterUserResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/users/signup",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Read User By Id
   * Get a specific user by id.
   * @param data The data for the request.
   * @param data.userId
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static readUserById(
    data: UsersReadUserByIdData,
  ): CancelablePromise<UsersReadUserByIdResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/users/{user_id}",
      path: {
        user_id: data.userId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Update User
   * Update a user.
   * @param data The data for the request.
   * @param data.userId
   * @param data.requestBody
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static updateUser(
    data: UsersUpdateUserData,
  ): CancelablePromise<UsersUpdateUserResponse> {
    return __request(OpenAPI, {
      method: "PATCH",
      url: "/api/v1/users/{user_id}",
      path: {
        user_id: data.userId,
      },
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Delete User
   * Delete a user.
   * @param data The data for the request.
   * @param data.userId
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static deleteUser(
    data: UsersDeleteUserData,
  ): CancelablePromise<UsersDeleteUserResponse> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/users/{user_id}",
      path: {
        user_id: data.userId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class UtilsService {
  /**
   * Test Email
   * Test emails.
   * @param data The data for the request.
   * @param data.emailTo
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static testEmail(
    data: UtilsTestEmailData,
  ): CancelablePromise<UtilsTestEmailResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/utils/test-email/",
      query: {
        email_to: data.emailTo,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Health Check
   * @returns boolean Successful Response
   * @throws ApiError
   */
  public static healthCheck(): CancelablePromise<UtilsHealthCheckResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/utils/health-check/",
    })
  }
}

export class WeatherService {
  /**
   * Get Two Hour Forecast
   * Retrieve the latest two hour weather forecast from data.gov.sg API.
   *
   * - Updated half-hourly from NEA
   * - Forecasts are given for multiple areas in Singapore
   * @param data The data for the request.
   * @param data.date SGT date for which to retrieve data (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns WeatherResponse Successful Response
   * @throws ApiError
   */
  public static getTwoHourForecast(
    data: WeatherGetTwoHourForecastData = {},
  ): CancelablePromise<WeatherGetTwoHourForecastResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/two-hour-forecast",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Air Temperature
   * Get air temperature readings across Singapore
   *
   * - Has per-minute readings from NEA
   * - Unit of measure for readings is °C
   * @param data The data for the request.
   * @param data.date Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS (SGT). Example: 2024-07-16 or 2024-07-16T23:59:00
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns AirTemperatureResponse Successful Response
   * @throws ApiError
   */
  public static getAirTemperature(
    data: WeatherGetAirTemperatureData = {},
  ): CancelablePromise<WeatherGetAirTemperatureResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/air-temperature",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Wind Direction
   * Get wind direction readings across Singapore
   *
   * - Has per-minute readings from NEA
   * - Unit of measure for readings is °
   * @param data The data for the request.
   * @param data.date SGT date for which to retrieve data (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns WindDirectionResponse Successful Response
   * @throws ApiError
   */
  public static getWindDirection(
    data: WeatherGetWindDirectionData = {},
  ): CancelablePromise<WeatherGetWindDirectionResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/wind-direction",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Lightning
   * Retrieve the latest lightning observation
   *
   * - Updated multiple times throughout the day
   * @param data The data for the request.
   * @param data.date SGT date (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS). Example: 2025-01-16 or 2025-01-16T23:59:00
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns LightningResponse Successful Response
   * @throws ApiError
   */
  public static getLightning(
    data: WeatherGetLightningData = {},
  ): CancelablePromise<WeatherGetLightningResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/lightning",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Wbgt
   * Retrieve the latest WBGT (Wet Bulb Globe Temperature) data for accurate heat stress assessment
   *
   * - Updated multiple times throughout the day
   * - Unit of measure for readings is °C
   * @param data The data for the request.
   * @param data.date SGT date (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS). Example: 2025-01-16 or 2025-01-16T23:59:00
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns WBGTResponse Successful Response
   * @throws ApiError
   */
  public static getWbgt(
    data: WeatherGetWbgtData = {},
  ): CancelablePromise<WeatherGetWbgtResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/wbgt",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Twenty Four Hour Forecast
   * Retrieve the latest 24 hour weather forecast
   *
   * - Updated multiple times throughout the day
   * - Provides forecasts for different areas of Singapore
   * @param data The data for the request.
   * @param data.date SGT date (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS). Example: 2024-07-16 or 2024-07-16T23:59:00
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns TwentyFourHourForecastResponse Successful Response
   * @throws ApiError
   */
  public static getTwentyFourHourForecast(
    data: WeatherGetTwentyFourHourForecastData = {},
  ): CancelablePromise<WeatherGetTwentyFourHourForecastResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/twenty-four-hour-forecast",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Four Day Outlook
   * Retrieve the latest 4 day weather forecast
   *
   * - Updated twice a day from NEA
   * - The forecast is for the next 4 days
   * @param data The data for the request.
   * @param data.date SGT date for which to retrieve data (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)
   * @param data.paginationToken Pagination token for retrieving subsequent data pages
   * @returns FourDayForecastResponse Successful Response
   * @throws ApiError
   */
  public static getFourDayOutlook(
    data: WeatherGetFourDayOutlookData = {},
  ): CancelablePromise<WeatherGetFourDayOutlookResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/weather/four-day-outlook",
      query: {
        date: data.date,
        pagination_token: data.paginationToken,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}
