import type { CancelablePromise } from "./core/CancelablePromise"
import { OpenAPI } from "./core/OpenAPI"
import { request as __request } from "./core/request"

import type {
  Body_login_login_access_token,
  ItemCreate,
  ItemPublic,
  ItemUpdate,
  ItemsPublic,
  Message,
  NewPassword,
  Token,
  UpdatePassword,
  UserCreate,
  UserPublic,
  UserRegister,
  UserUpdate,
  UserUpdateMe,
  UsersPublic,
  ClientMessagesPublic,
  WebSettingPublic,
  WebSettingUpdate,
  OrganPublic,
  OrgansPublic,
  OrganUpdate,
  OrganCreate,
  AboutUssPublic,
  AboutUsUpdate,
  AboutUsCreate,
  CoursesPublic,
  CourseCreate,
  CourseDetailsPublic,
  CourseUpdate,
  ImagePublic,
  ScheduleCreate,
  ScheduleUpdate,
  ImageCreate,
} from "./models"

export type TDataLoginAccessToken = {
  formData: Body_login_login_access_token
}
export type TDataRecoverPassword = {
  email: string
}
export type TDataResetPassword = {
  requestBody: NewPassword
}
export type TDataRecoverPasswordHtmlContent = {
  email: string
}

export class LoginService {
  /**
   * Login Access Token
   * OAuth2 compatible token login, get an access token for future requests
   * @returns Token Successful Response
   * @throws ApiError
   */
  public static loginAccessToken(
    data: TDataLoginAccessToken,
  ): CancelablePromise<Token> {
    const { formData } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/login/access-token",
      formData: 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<UserPublic> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/login/test-token",
    })
  }

  /**
   * Recover Password
   * Password Recovery
   * @returns Message Successful Response
   * @throws ApiError
   */
  public static recoverPassword(
    data: TDataRecoverPassword,
  ): CancelablePromise<Message> {
    const { email } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/password-recovery/{email}",
      path: {
        email,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

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

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

export type TDataReadUsers = {
  limit?: number
  skip?: number
}
export type TDataCreateUser = {
  requestBody: UserCreate
}
export type TDataUpdateUserMe = {
  requestBody: UserUpdateMe
}
export type TDataUpdatePasswordMe = {
  requestBody: UpdatePassword
}
export type TDataRegisterUser = {
  requestBody: UserRegister
}
export type TDataReadUserById = {
  userId: string
}
export type TDataUpdateUser = {
  requestBody: UserUpdate
  userId: string
}
export type TDataDeleteUser = {
  userId: string
}

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

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

  /**
   * Read User Me
   * Get current user.
   * @returns UserPublic Successful Response
   * @throws ApiError
   */
  public static readUserMe(): CancelablePromise<UserPublic> {
    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<Message> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/users/me",
    })
  }

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

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

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

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

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

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

export type TDataTestEmail = {
  emailTo: string
}

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

export type TDataReadMessages = {
  limit?: number
  skip?: number
}

export type TDataDeleteMessage = {
  id: string
}

export class ClientMessagesService {
  /**
   * Read Messages
   * Retrieve messages.
   * @returns MessagesPublic Successful Response
   * @throws ApiError
   */
  public static readMessages(
    data: TDataReadMessages = {},
  ): CancelablePromise<ClientMessagesPublic> {
    const { limit = 100, skip = 0 } = data
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/messages/",
      query: {
        skip,
        limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }


  /**
 * Delete Message
 * Delete an Message.
 * @returns Message Successful Response
 * @throws ApiError
 */

  public static deleteMessage(data: TDataDeleteMessage): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/messages/{id}",
      path: {
        id: id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }


}


export type TDataReadOrgan = {
  limit?: number
  skip?: number
}
export type TDataCreateOrgan = {
  formData: OrganCreate
}
export type TDataUpdateOrgan = {
  id: string
  formData: OrganUpdate
}
export type TDataDeleteOrgan = {
  id: string
}
export class OrganService {
  /**
   * Read Organ
   * Retrieve organ.
   * @returns OrganPublic Successful Response
   * @throws ApiError
   */
  public static readOrgan(
    data: TDataReadOrgan = {},
  ): CancelablePromise<OrgansPublic> {
    const { limit = 100, skip = 0 } = data
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/organ/",
      query: {
        skip,
        limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static createOrgan(
    data: TDataCreateOrgan,
  ): CancelablePromise<OrganPublic> {
    const { formData } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/organ/",
      formData: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }
  public static updateOrgan(
    data: TDataUpdateOrgan,
  ): CancelablePromise<OrganPublic> {
    const { id, formData } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/organ/{id}",
      path: {
        id: id,
      },
      formData: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static deleteOrgan(data: TDataDeleteOrgan): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/organ/{id}",
      path: {
        id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}


export type TDataReadAboutUs = {
  limit?: number
  skip?: number
}
export type TDataCreateAboutUs = {
  formData: AboutUsCreate
}

export type TDataUpdateAboutUs = {
  id: string
  formData: AboutUsUpdate
}
export type TDataDeleteAboutUs = {
  id: string
}

export class AboutUsService {
  /**
   * Read About Us
   * Retrieve about us.
   * @returns AboutUsPublic Successful Response
   * @throws ApiError
   */

  public static readAboutUs(
    data: TDataReadAboutUs = {},
  ): CancelablePromise<AboutUssPublic> {
    const { limit = 100, skip = 0 } = data
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/aboutUs/",
      query: {
        skip,
        limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }


  public static createAboutUs(
    data: TDataCreateAboutUs,
  ): CancelablePromise<AboutUsCreate> {
    const { formData } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/aboutUs/",
      formData: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static updateAboutUs(
    data: TDataUpdateAboutUs,
  ): CancelablePromise<AboutUsUpdate> {
    const { id, formData } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/aboutUs/{id}",
      path: {
        id: id,
      },
      body: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
 * Delete About us
 * Delete an About us.
 * @returns About us Successful Response
 * @throws ApiError
 */
  public static deleteAboutUs(data: TDataDeleteAboutUs): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/aboutUs/{id}",
      path: {
        id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }


}

export type TDataCreateSechedule = {
  requestBody: ScheduleCreate
}

export type TDataUpdateSechedule = {
  id: string
  requestBody: ScheduleUpdate
}

export type TDataDeleteSechedule = {
  id: string
}

export class secheduleService {
  /**
   * Create Sechedule
   * Create an Sechedule.
   * @returns ScheduleCreate Successful Response
   * @throws ApiError
   */
  public static createSechedule(
    data: TDataCreateSechedule,
  ): CancelablePromise<ScheduleCreate> {
    const { requestBody } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/sechedule/",
      body: requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }
  public static updateSechedule(
    data: TDataUpdateSechedule,
  ): CancelablePromise<ScheduleUpdate> {
    const { id, requestBody } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/sechedule/{id}",
      path: {
        id: id,
      },
      body: requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }
  public static deleteSechedule(data: TDataDeleteSechedule): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/sechedule/{id}",
      path: {
        id: id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export type TDataCreateImage = {
  formData: ImageCreate
}
export type TDataImageUpdate = {
  id: string
  index: number
}
export type TDataDeleteImage = {
  id: string
}

export class ImageService {
  /**
   * Create Image
   * Create an Image.
   * @returns ImageCreate Successful Response
   * @throws ApiError
   */
  public static createImage(
    data: TDataCreateImage,
  ): CancelablePromise<ImageCreate> {
    const { formData } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/image/",
      formData: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static updateImage(
    data: TDataImageUpdate,
  ): CancelablePromise<ImagePublic> {
    const { id, index } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/image/{id}?index={index}",
      path: {
        id: id,
        index: index,
      },
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })

  }

  public static deleteImage(data: TDataDeleteImage): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/image/{id}",
      path: {
        id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

}


export class Info_imageService {
  /**
  * Read Courses
  * Retrieve courses.
  * @returns CoursesPublic Successful Response
  * @throws ApiError
  */
  public static createImage(
    data: TDataCreateImage,
  ): CancelablePromise<ImageCreate> {
    const { formData } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/info_image/",
      formData: formData,
      mediaType: "multipart/form-data",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static updateImage(
    data: TDataImageUpdate,
  ): CancelablePromise<ImagePublic> {
    const { id, index } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/info_image/{id}?index={index}",
      path: {
        id: id,
        index: index,
      },
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static deleteImage(data: TDataDeleteImage): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/info_image/{id}",
      path: {
        id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}


export type TDataReadCourses = {
  limit?: number
  skip?: number
}
export type TDataCreate = {
  requestBody: CourseCreate
}

export type TDataReadCourse = {
  id: String
}

export type TDataUpdateCourse = {
  id: string
  requestBody: CourseUpdate
}

export class CoursesService {
  /**
   * Read Courses
   * Retrieve courses.
   * @returns CoursesPublic Successful Response
   * @throws ApiError
   */
  public static readCourses(
    data: TDataReadCourses = {},
  ): CancelablePromise<CoursesPublic> {
    const { limit = 100, skip = 0 } = data
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/course/",
      query: {
        skip,
        limit,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static createCourse(
    data: TDataCreate,
  ): CancelablePromise<CourseCreate> {
    const { requestBody } = data
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/v1/course/",
      body: requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static updateCourse(
    data: TDataUpdateCourse,
  ): CancelablePromise<CourseUpdate> {
    const { id, requestBody } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/course/{id}",
      path: {
        id: id,
      },
      body: requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }


  public static readCourse(
    data: TDataReadCourse,
  ): CancelablePromise<CourseDetailsPublic> {
    const { id } = data
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/course/{id}",
      path: {
        id: id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static deleteCourse(
    data: TDataReadCourse,
  ): CancelablePromise<Message> {
    const { id } = data
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/v1/course/{id}",
      path: {
        id: id,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

}



export type TDataReadItems = {
  limit?: number
  skip?: number
}
export type TDataCreateItem = {
  requestBody: ItemCreate
}
export type TDataReadItem = {
  id: string
}
export type TDataUpdateItem = {
  id: string
  requestBody: ItemUpdate
}
export type TDataDeleteItem = {
  id: string
}


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

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

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

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

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

export type TDataReadWebSetting = {

}

export type TDataUpdateWebSetting = {
  requestBody: WebSettingUpdate
}



export class WebSettingsService {
  /**
   * Read Web Setting
   * Retrieve web setting.
   * @returns WebSettingPublic Successful Response
   * @throws ApiError
   * */

  public static readWebSetting(
  ): CancelablePromise<WebSettingPublic> {
    console.log("readWebSetting")
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/v1/setting/",
      errors: {
        422: "Validation Error",
      },
    })
  }

  public static updateWebSetting(
    data: TDataUpdateWebSetting,
  ): CancelablePromise<WebSettingPublic> {
    const { requestBody } = data
    return __request(OpenAPI, {
      method: "PUT",
      url: "/api/v1/setting/",
      body: requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }

}