/* tslint:disable */
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */

import { HttpClient, HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';

import { FindActionResDto } from '../models/find-action-res-dto';
import { FindPrivilegeResDto } from '../models/find-privilege-res-dto';
import { FindRoleResDto } from '../models/find-role-res-dto';
import { rolesControllerDeleteRolePrivilege } from '../fn/roles/roles-controller-delete-role-privilege';
import { RolesControllerDeleteRolePrivilege$Params } from '../fn/roles/roles-controller-delete-role-privilege';
import { rolesControllerFetchRoles } from '../fn/roles/roles-controller-fetch-roles';
import { RolesControllerFetchRoles$Params } from '../fn/roles/roles-controller-fetch-roles';
import { rolesControllerGetAvailableRolePrivileges } from '../fn/roles/roles-controller-get-available-role-privileges';
import { RolesControllerGetAvailableRolePrivileges$Params } from '../fn/roles/roles-controller-get-available-role-privileges';
import { rolesControllerGetRolePrivileges } from '../fn/roles/roles-controller-get-role-privileges';
import { RolesControllerGetRolePrivileges$Params } from '../fn/roles/roles-controller-get-role-privileges';
import { rolesControllerSetPrivilegeFlagEnabled } from '../fn/roles/roles-controller-set-privilege-flag-enabled';
import { RolesControllerSetPrivilegeFlagEnabled$Params } from '../fn/roles/roles-controller-set-privilege-flag-enabled';
import { rolesControllerSetPrivilegeFlagReadonly } from '../fn/roles/roles-controller-set-privilege-flag-readonly';
import { RolesControllerSetPrivilegeFlagReadonly$Params } from '../fn/roles/roles-controller-set-privilege-flag-readonly';
import { rolesControllerSetRolePrivileges } from '../fn/roles/roles-controller-set-role-privileges';
import { RolesControllerSetRolePrivileges$Params } from '../fn/roles/roles-controller-set-role-privileges';

@Injectable({ providedIn: 'root' })
export class RolesApiClient extends BaseService {
  constructor(config: ApiConfiguration, http: HttpClient) {
    super(config, http);
  }

  /** Path part for operation `rolesControllerFetchRoles()` */
  static readonly RolesControllerFetchRolesPath = '/admin/roles';

  /**
   * Get all roles.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerFetchRoles()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerFetchRoles$Response(
    params?: RolesControllerFetchRoles$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<Array<FindRoleResDto>>> {
    return rolesControllerFetchRoles(this.http, this.rootUrl, params, context);
  }

  /**
   * Get all roles.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerFetchRoles$Response()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerFetchRoles(
    params?: RolesControllerFetchRoles$Params,
    context?: HttpContext,
  ): Observable<Array<FindRoleResDto>> {
    return this.rolesControllerFetchRoles$Response(params, context).pipe(
      map(
        (r: StrictHttpResponse<Array<FindRoleResDto>>): Array<FindRoleResDto> =>
          r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerGetRolePrivileges()` */
  static readonly RolesControllerGetRolePrivilegesPath =
    '/admin/roles/id/{id}/privileges';

  /**
   * Get role privileges.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerGetRolePrivileges()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerGetRolePrivileges$Response(
    params: RolesControllerGetRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<Array<FindPrivilegeResDto>>> {
    return rolesControllerGetRolePrivileges(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Get role privileges.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerGetRolePrivileges$Response()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerGetRolePrivileges(
    params: RolesControllerGetRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<Array<FindPrivilegeResDto>> {
    return this.rolesControllerGetRolePrivileges$Response(params, context).pipe(
      map(
        (
          r: StrictHttpResponse<Array<FindPrivilegeResDto>>,
        ): Array<FindPrivilegeResDto> => r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerSetRolePrivileges()` */
  static readonly RolesControllerSetRolePrivilegesPath =
    '/admin/roles/id/{id}/privileges';

  /**
   * Add privileges to role.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerSetRolePrivileges()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetRolePrivileges$Response(
    params: RolesControllerSetRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<Array<FindPrivilegeResDto>>> {
    return rolesControllerSetRolePrivileges(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Add privileges to role.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerSetRolePrivileges$Response()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetRolePrivileges(
    params: RolesControllerSetRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<Array<FindPrivilegeResDto>> {
    return this.rolesControllerSetRolePrivileges$Response(params, context).pipe(
      map(
        (
          r: StrictHttpResponse<Array<FindPrivilegeResDto>>,
        ): Array<FindPrivilegeResDto> => r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerGetAvailableRolePrivileges()` */
  static readonly RolesControllerGetAvailableRolePrivilegesPath =
    '/admin/roles/id/{id}/privileges/available';

  /**
   * Get available actions by role.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerGetAvailableRolePrivileges()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerGetAvailableRolePrivileges$Response(
    params: RolesControllerGetAvailableRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<Array<FindActionResDto>>> {
    return rolesControllerGetAvailableRolePrivileges(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Get available actions by role.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerGetAvailableRolePrivileges$Response()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerGetAvailableRolePrivileges(
    params: RolesControllerGetAvailableRolePrivileges$Params,
    context?: HttpContext,
  ): Observable<Array<FindActionResDto>> {
    return this.rolesControllerGetAvailableRolePrivileges$Response(
      params,
      context,
    ).pipe(
      map(
        (
          r: StrictHttpResponse<Array<FindActionResDto>>,
        ): Array<FindActionResDto> => r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerSetPrivilegeFlagReadonly()` */
  static readonly RolesControllerSetPrivilegeFlagReadonlyPath =
    '/admin/roles/privilege/id/{id}/flag-readonly';

  /**
   * Set flag readonly.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerSetPrivilegeFlagReadonly()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetPrivilegeFlagReadonly$Response(
    params: RolesControllerSetPrivilegeFlagReadonly$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<FindPrivilegeResDto>> {
    return rolesControllerSetPrivilegeFlagReadonly(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Set flag readonly.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerSetPrivilegeFlagReadonly$Response()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetPrivilegeFlagReadonly(
    params: RolesControllerSetPrivilegeFlagReadonly$Params,
    context?: HttpContext,
  ): Observable<FindPrivilegeResDto> {
    return this.rolesControllerSetPrivilegeFlagReadonly$Response(
      params,
      context,
    ).pipe(
      map(
        (r: StrictHttpResponse<FindPrivilegeResDto>): FindPrivilegeResDto =>
          r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerSetPrivilegeFlagEnabled()` */
  static readonly RolesControllerSetPrivilegeFlagEnabledPath =
    '/admin/roles/privilege/id/{id}/flag-enabled';

  /**
   * Set flag enabled.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerSetPrivilegeFlagEnabled()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetPrivilegeFlagEnabled$Response(
    params: RolesControllerSetPrivilegeFlagEnabled$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<FindPrivilegeResDto>> {
    return rolesControllerSetPrivilegeFlagEnabled(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Set flag enabled.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerSetPrivilegeFlagEnabled$Response()` instead.
   *
   * This method sends `application/json` and handles request body of type `application/json`.
   */
  rolesControllerSetPrivilegeFlagEnabled(
    params: RolesControllerSetPrivilegeFlagEnabled$Params,
    context?: HttpContext,
  ): Observable<FindPrivilegeResDto> {
    return this.rolesControllerSetPrivilegeFlagEnabled$Response(
      params,
      context,
    ).pipe(
      map(
        (r: StrictHttpResponse<FindPrivilegeResDto>): FindPrivilegeResDto =>
          r.body,
      ),
    );
  }

  /** Path part for operation `rolesControllerDeleteRolePrivilege()` */
  static readonly RolesControllerDeleteRolePrivilegePath =
    '/admin/roles/privilege/id/{id}';

  /**
   * Delete role privilege.
   *
   *
   *
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
   * To access only the response body, use `rolesControllerDeleteRolePrivilege()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerDeleteRolePrivilege$Response(
    params: RolesControllerDeleteRolePrivilege$Params,
    context?: HttpContext,
  ): Observable<StrictHttpResponse<Array<FindPrivilegeResDto>>> {
    return rolesControllerDeleteRolePrivilege(
      this.http,
      this.rootUrl,
      params,
      context,
    );
  }

  /**
   * Delete role privilege.
   *
   *
   *
   * This method provides access only to the response body.
   * To access the full response (for headers, for example), `rolesControllerDeleteRolePrivilege$Response()` instead.
   *
   * This method doesn't expect any request body.
   */
  rolesControllerDeleteRolePrivilege(
    params: RolesControllerDeleteRolePrivilege$Params,
    context?: HttpContext,
  ): Observable<Array<FindPrivilegeResDto>> {
    return this.rolesControllerDeleteRolePrivilege$Response(
      params,
      context,
    ).pipe(
      map(
        (
          r: StrictHttpResponse<Array<FindPrivilegeResDto>>,
        ): Array<FindPrivilegeResDto> => r.body,
      ),
    );
  }
}
