/* 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 {
  AdminCollectionAddProducts,
  AdminCollectionCreate,
  AdminCollectionCursorPage,
  AdminCollectionUpdate,
  ApiCollectionV1AdminCollectionsDelete200Response,
  ApiCollectionV1AdminCollectionsProductsDelete200Response,
} from '../models';

export interface ApiCollectionV1AdminCollectionsCreateRequest {
    data: AdminCollectionCreate;
}

export interface ApiCollectionV1AdminCollectionsDeleteRequest {
    id: string;
}

export interface ApiCollectionV1AdminCollectionsListRequest {
    cursor?: string;
    pageSize?: number;
    creatorType?: ApiCollectionV1AdminCollectionsListCreatorTypeEnum;
    isPublic?: boolean;
    q?: string;
    creatorId?: string;
}

export interface ApiCollectionV1AdminCollectionsPartialUpdateRequest {
    id: string;
    data: AdminCollectionUpdate;
}

export interface ApiCollectionV1AdminCollectionsProductsCreateRequest {
    id: string;
    data: AdminCollectionAddProducts;
}

export interface ApiCollectionV1AdminCollectionsProductsDeleteRequest {
    id: string;
    productId: string;
}

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

    /**
     * Create a global collection as staff. Returns the created resource.
     * Create admin collection
     */
    async apiCollectionV1AdminCollectionsCreateRaw(requestParameters: ApiCollectionV1AdminCollectionsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdminCollectionCreate>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1AdminCollectionsCreate.');
        }

        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/collection/v1/admin/collections/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a global collection as staff. Returns the created resource.
     * Create admin collection
     */
    async apiCollectionV1AdminCollectionsCreate(requestParameters: ApiCollectionV1AdminCollectionsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdminCollectionCreate> {
        const response = await this.apiCollectionV1AdminCollectionsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Delete admin collection
     */
    async apiCollectionV1AdminCollectionsDeleteRaw(requestParameters: ApiCollectionV1AdminCollectionsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiCollectionV1AdminCollectionsDelete200Response>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1AdminCollectionsDelete.');
        }

        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/collection/v1/admin/collections/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Delete admin collection
     */
    async apiCollectionV1AdminCollectionsDelete(requestParameters: ApiCollectionV1AdminCollectionsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiCollectionV1AdminCollectionsDelete200Response> {
        const response = await this.apiCollectionV1AdminCollectionsDeleteRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * List all collections with filters. Cursor-paginated. Filters: creator_type (seller/admin), is_public (true/false), q (search title/description), creator_id (UUID).
     * List collections (admin)
     */
    async apiCollectionV1AdminCollectionsListRaw(requestParameters: ApiCollectionV1AdminCollectionsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdminCollectionCursorPage>> {
        const queryParameters: any = {};

        if (requestParameters.cursor !== undefined) {
            queryParameters['cursor'] = requestParameters.cursor;
        }

        if (requestParameters.pageSize !== undefined) {
            queryParameters['pageSize'] = requestParameters.pageSize;
        }

        if (requestParameters.creatorType !== undefined) {
            queryParameters['creator_type'] = requestParameters.creatorType;
        }

        if (requestParameters.isPublic !== undefined) {
            queryParameters['is_public'] = requestParameters.isPublic;
        }

        if (requestParameters.q !== undefined) {
            queryParameters['q'] = requestParameters.q;
        }

        if (requestParameters.creatorId !== undefined) {
            queryParameters['creator_id'] = requestParameters.creatorId;
        }

        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/collection/v1/admin/collections/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * List all collections with filters. Cursor-paginated. Filters: creator_type (seller/admin), is_public (true/false), q (search title/description), creator_id (UUID).
     * List collections (admin)
     */
    async apiCollectionV1AdminCollectionsList(requestParameters: ApiCollectionV1AdminCollectionsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdminCollectionCursorPage> {
        const response = await this.apiCollectionV1AdminCollectionsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Update admin collection
     */
    async apiCollectionV1AdminCollectionsPartialUpdateRaw(requestParameters: ApiCollectionV1AdminCollectionsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdminCollectionUpdate>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1AdminCollectionsPartialUpdate.');
        }

        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1AdminCollectionsPartialUpdate.');
        }

        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/collection/v1/admin/collections/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Update admin collection
     */
    async apiCollectionV1AdminCollectionsPartialUpdate(requestParameters: ApiCollectionV1AdminCollectionsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdminCollectionUpdate> {
        const response = await this.apiCollectionV1AdminCollectionsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Admin can add any products. Duplicates are skipped. Honors COLLECTION_MAX_PRODUCTS cap if configured.
     * Add product(s) to admin collection
     */
    async apiCollectionV1AdminCollectionsProductsCreateRaw(requestParameters: ApiCollectionV1AdminCollectionsProductsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AdminCollectionAddProducts>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1AdminCollectionsProductsCreate.');
        }

        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1AdminCollectionsProductsCreate.');
        }

        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/collection/v1/admin/collections/{id}/products/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Admin can add any products. Duplicates are skipped. Honors COLLECTION_MAX_PRODUCTS cap if configured.
     * Add product(s) to admin collection
     */
    async apiCollectionV1AdminCollectionsProductsCreate(requestParameters: ApiCollectionV1AdminCollectionsProductsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AdminCollectionAddProducts> {
        const response = await this.apiCollectionV1AdminCollectionsProductsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Remove product from admin collection
     */
    async apiCollectionV1AdminCollectionsProductsDeleteRaw(requestParameters: ApiCollectionV1AdminCollectionsProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiCollectionV1AdminCollectionsProductsDelete200Response>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1AdminCollectionsProductsDelete.');
        }

        if (requestParameters.productId === null || requestParameters.productId === undefined) {
            throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling apiCollectionV1AdminCollectionsProductsDelete.');
        }

        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/collection/v1/admin/collections/{id}/products/{product_id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"product_id"}}`, encodeURIComponent(String(requestParameters.productId))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Remove product from admin collection
     */
    async apiCollectionV1AdminCollectionsProductsDelete(requestParameters: ApiCollectionV1AdminCollectionsProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiCollectionV1AdminCollectionsProductsDelete200Response> {
        const response = await this.apiCollectionV1AdminCollectionsProductsDeleteRaw(requestParameters, initOverrides);
        return await response.value();
    }

}

/**
 * @export
 */
export const ApiCollectionV1AdminCollectionsListCreatorTypeEnum = {
    Seller: 'seller',
    Admin: 'admin',
    User: 'user'
} as const;
export type ApiCollectionV1AdminCollectionsListCreatorTypeEnum = typeof ApiCollectionV1AdminCollectionsListCreatorTypeEnum[keyof typeof ApiCollectionV1AdminCollectionsListCreatorTypeEnum];
