/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { RoleEnum } from '../models/RoleEnum';
import type { UserIn } from '../models/UserIn';
import type { UserOut } from '../models/UserOut';
import type { UserOutExtended } from '../models/UserOutExtended';
import type { UserRoles } from '../models/UserRoles';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class UserService {
    /**
     * Create User
     * Create a new user in the system and notify him.
     *
     * Permission `user:create` required.
     * @param requestBody
     * @returns UserOutExtended Successful Response
     * @throws ApiError
     */
    public static userCreateUser(
        requestBody: UserIn,
    ): CancelablePromise<UserOutExtended> {
        return __request(OpenAPI, {
            method: 'POST',
            url: '/users',
            body: requestBody,
            mediaType: 'application/json',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * List users and search by their name
     * List all users in the system..
     *
     * Permission `user:list` required.
     * @param nameSubstring Filter users by a substring in their name.
     * @param filterRoles Filter users by their role. If multiple are selected, they are concatenating by an OR Expression.
     * @returns UserOutExtended Successful Response
     * @throws ApiError
     */
    public static userListUsers(
        nameSubstring?: string,
        filterRoles?: Array<RoleEnum>,
    ): CancelablePromise<Array<UserOutExtended>> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users',
            query: {
                'name_substring': nameSubstring,
                'filter_roles': filterRoles,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Search Users
     * Search for users in the system by their name.
     *
     * Permission `user: search` required.
     * @param nameSubstring Filter users by a substring in their name.
     * @returns UserOut Successful Response
     * @throws ApiError
     */
    public static userSearchUsers(
        nameSubstring: string,
    ): CancelablePromise<Array<UserOut>> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users/search',
            query: {
                'name_substring': nameSubstring,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Get the logged in user
     * Return the user associated with the used JWT.
     *
     * Permission `user:read` required.
     * @returns UserOutExtended Successful Response
     * @throws ApiError
     */
    public static userGetLoggedInUser(): CancelablePromise<UserOutExtended> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users/me',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
            },
        });
    }
    /**
     * Get a user by its uid
     * Return the user with the specific uid.
     *
     * Permission `user:read` required.
     * @param uid UID of a user
     * @returns UserOut Successful Response
     * @throws ApiError
     */
    public static userGetUser(
        uid: string,
    ): CancelablePromise<UserOut> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/users/{uid}',
            path: {
                'uid': uid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Update Roles
     * Update the roles of a user.
     *
     * Permission `user:update` required.
     * @param uid UID of a user
     * @param requestBody
     * @returns UserOutExtended Successful Response
     * @throws ApiError
     */
    public static userUpdateRoles(
        uid: string,
        requestBody: UserRoles,
    ): CancelablePromise<UserOutExtended> {
        return __request(OpenAPI, {
            method: 'PUT',
            url: '/users/{uid}/roles',
            path: {
                'uid': uid,
            },
            body: requestBody,
            mediaType: 'application/json',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Resend Invitation
     * Resend the invitation link for an user that has an open invitation.
     *
     * Permission `user:create` required.
     * @param uid UID of a user
     * @returns UserOutExtended Successful Response
     * @throws ApiError
     */
    public static userResendInvitation(
        uid: string,
    ): CancelablePromise<UserOutExtended> {
        return __request(OpenAPI, {
            method: 'PATCH',
            url: '/users/{uid}/invitation',
            path: {
                'uid': uid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
}