/* tslint:disable */
/* eslint-disable */
/**
 * Vitron API
 * API documentation for Vitron backend
 *
 * The version of the OpenAPI document: v1
 * Contact: support@yourcompany.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import type {
  ApiEngagementV1FollowsCheckRead200Response,
  FollowCreate,
  FollowList,
} from '../models';

export interface ApiEngagementV1FollowsCheckReadRequest {
    sellerId: string;
}

export interface ApiEngagementV1FollowsCreateRequest {
    data: FollowCreate;
}

export interface ApiEngagementV1FollowsDeleteRequest {
    sellerId: string;
}

/**
 * 
 */
export class FollowsManagementApi extends runtime.BaseAPI {

    /**
     * Check if the authenticated user is following the specified seller.
     * Check follow status
     */
    async apiEngagementV1FollowsCheckReadRaw(requestParameters: ApiEngagementV1FollowsCheckReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiEngagementV1FollowsCheckRead200Response>> {
        if (requestParameters.sellerId === null || requestParameters.sellerId === undefined) {
            throw new runtime.RequiredError('sellerId','Required parameter requestParameters.sellerId was null or undefined when calling apiEngagementV1FollowsCheckRead.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/engagement/v1/follows/check/{seller_id}/`.replace(`{${"seller_id"}}`, encodeURIComponent(String(requestParameters.sellerId))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Check if the authenticated user is following the specified seller.
     * Check follow status
     */
    async apiEngagementV1FollowsCheckRead(requestParameters: ApiEngagementV1FollowsCheckReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiEngagementV1FollowsCheckRead200Response> {
        const response = await this.apiEngagementV1FollowsCheckReadRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * User follows a seller by providing seller UUID.
     * Follow a seller
     */
    async apiEngagementV1FollowsCreateRaw(requestParameters: ApiEngagementV1FollowsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FollowCreate>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiEngagementV1FollowsCreate.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/engagement/v1/follows/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * User follows a seller by providing seller UUID.
     * Follow a seller
     */
    async apiEngagementV1FollowsCreate(requestParameters: ApiEngagementV1FollowsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FollowCreate> {
        const response = await this.apiEngagementV1FollowsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Remove the follow relationship with a seller.
     * Unfollow a seller
     */
    async apiEngagementV1FollowsDeleteRaw(requestParameters: ApiEngagementV1FollowsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.sellerId === null || requestParameters.sellerId === undefined) {
            throw new runtime.RequiredError('sellerId','Required parameter requestParameters.sellerId was null or undefined when calling apiEngagementV1FollowsDelete.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/engagement/v1/follows/{seller_id}/`.replace(`{${"seller_id"}}`, encodeURIComponent(String(requestParameters.sellerId))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Remove the follow relationship with a seller.
     * Unfollow a seller
     */
    async apiEngagementV1FollowsDelete(requestParameters: ApiEngagementV1FollowsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiEngagementV1FollowsDeleteRaw(requestParameters, initOverrides);
    }

    /**
     * Returns a list of seller UUIDs that the current user is following.
     * List followed sellers
     */
    async apiEngagementV1FollowsListListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<FollowList>>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/engagement/v1/follows/list`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Returns a list of seller UUIDs that the current user is following.
     * List followed sellers
     */
    async apiEngagementV1FollowsListList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<FollowList>> {
        const response = await this.apiEngagementV1FollowsListListRaw(initOverrides);
        return await response.value();
    }

}
