/* 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 {
  Attribute,
  FullProductCreate,
  FullProductUpdate,
  Product,
  ProductActivation,
  ProductAttributeItem,
  ProductAttributeValue,
  ProductCategory,
  ProductCreate,
  ProductDetail,
  ProductGroupedAttributes,
  ProductOwnershipCheck,
  ProductVariant,
  SellerProductListItem,
  VariantStockUpdateRequest,
  VariantStockUpdateResponse,
  ProductBasePriceUpdateRequest,
  ProductBasePriceUpdateResponse,
  VariantPriceUpdateRequest,
  VariantPriceUpdateResponse,
} from '../models';

export interface ApiProductV1AttributeCreateRequest {
    data: Attribute;
}

export interface ApiProductV1AttributevalueCreateRequest {
    data: ProductAttributeValue;
}

export interface ApiProductV1CategoriesCreateRequest {
    data: ProductCategory;
}

export interface ApiProductV1ProductCreateRequest {
    data: ProductCreate;
}

export interface ApiProductV1ProductsActivatePartialUpdateRequest {
    data: ProductActivation;
}

export interface ApiProductV1ProductsAttributesCreateRequest {
    id: string;
    data: Array<ProductAttributeItem>;
}

export interface ApiProductV1ProductsAttributeslistListRequest {
    id: string;
}

export interface ApiProductV1ProductsDeleteRequest {
    id: string;
}

export interface ApiProductV1ProductsFullCreateCreateRequest {
    data: FullProductCreate;
}

export interface ApiProductV1ProductsIsOwnerListRequest {
    id: string;
}

export interface ApiProductV1ProductsListRequest {
    search?: string;
    ordering?: string;
    category?: string;
    seller?: string;
    minPrice?: number;
    maxPrice?: number;
}

export interface ApiProductV1ProductsPartialUpdateRequest {
    id: string;
    data: FullProductUpdate;
}

export interface ApiProductV1ProductsReadRequest {
    id: string;
}

export interface ApiProductV1ProductsVariantsCreateRequest {
    id: string;
    data: ProductVariant;
}

export interface ApiProductV1ProductsVariantsListRequest {
    id: string;
}

export interface ApiProductV1ProductsVariantsStockPartialUpdateRequest {
    data: VariantStockUpdateRequest;
}

export interface ApiProductV1ProductsBasePricePartialUpdateRequest {
    data: ProductBasePriceUpdateRequest;
}

export interface ApiProductV1ProductsVariantsPricePartialUpdateRequest {
    data: VariantPriceUpdateRequest;
}

export interface ApiProductV1SellerProductsListRequest {
    search?: string;
    ordering?: string;
}

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

    /**
     * Create a new product attribute (Admin only).
     */
    async apiProductV1AttributeCreateRaw(requestParameters: ApiProductV1AttributeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Attribute>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1AttributeCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new product attribute (Admin only).
     */
    async apiProductV1AttributeCreate(requestParameters: ApiProductV1AttributeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Attribute> {
        const response = await this.apiProductV1AttributeCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get all product attributes.
     */
    async apiProductV1AttributeListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Attribute>>> {
        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/product/v1/attribute/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Get all product attributes.
     */
    async apiProductV1AttributeList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Attribute>> {
        const response = await this.apiProductV1AttributeListRaw(initOverrides);
        return await response.value();
    }

    /**
     * Create a new attribute value (Admin only).
     */
    async apiProductV1AttributevalueCreateRaw(requestParameters: ApiProductV1AttributevalueCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductAttributeValue>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1AttributevalueCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new attribute value (Admin only).
     */
    async apiProductV1AttributevalueCreate(requestParameters: ApiProductV1AttributevalueCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductAttributeValue> {
        const response = await this.apiProductV1AttributevalueCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get all attribute values.
     */
    async apiProductV1AttributevalueListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProductAttributeValue>>> {
        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/product/v1/attributevalue/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Get all attribute values.
     */
    async apiProductV1AttributevalueList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProductAttributeValue>> {
        const response = await this.apiProductV1AttributevalueListRaw(initOverrides);
        return await response.value();
    }

    /**
     * Create a new category (Admin Only).
     */
    async apiProductV1CategoriesCreateRaw(requestParameters: ApiProductV1CategoriesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductCategory>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1CategoriesCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new category (Admin Only).
     */
    async apiProductV1CategoriesCreate(requestParameters: ApiProductV1CategoriesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductCategory> {
        const response = await this.apiProductV1CategoriesCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Retrieve a list of all product categories.
     */
    async apiProductV1CategoriesListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProductCategory>>> {
        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/product/v1/categories/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Retrieve a list of all product categories.
     */
    async apiProductV1CategoriesList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProductCategory>> {
        const response = await this.apiProductV1CategoriesListRaw(initOverrides);
        return await response.value();
    }

    /**
     * Create a new product (Only for sellers)
     */
    async apiProductV1ProductCreateRaw(requestParameters: ApiProductV1ProductCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductCreate>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new product (Only for sellers)
     */
    async apiProductV1ProductCreate(requestParameters: ApiProductV1ProductCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductCreate> {
        const response = await this.apiProductV1ProductCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Activate/deactivate a product
     */
    async apiProductV1ProductsActivatePartialUpdateRaw(requestParameters: ApiProductV1ProductsActivatePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductDetail>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductsActivatePartialUpdate.');
        }

        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/product/v1/products/activate/`,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Activate/deactivate a product
     */
    async apiProductV1ProductsActivatePartialUpdate(requestParameters: ApiProductV1ProductsActivatePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductDetail> {
        const response = await this.apiProductV1ProductsActivatePartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Bulk assign attributes and values to a product (seller only).
     */
    async apiProductV1ProductsAttributesCreateRaw(requestParameters: ApiProductV1ProductsAttributesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProductAttributeItem>>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsAttributesCreate.');
        }

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Bulk assign attributes and values to a product (seller only).
     */
    async apiProductV1ProductsAttributesCreate(requestParameters: ApiProductV1ProductsAttributesCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProductAttributeItem>> {
        const response = await this.apiProductV1ProductsAttributesCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Returns attribute-value pairs grouped by attribute name for a given product UUID.
     * Get grouped attributes and values for a product
     */
    async apiProductV1ProductsAttributeslistListRaw(requestParameters: ApiProductV1ProductsAttributeslistListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductGroupedAttributes>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsAttributeslistList.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Returns attribute-value pairs grouped by attribute name for a given product UUID.
     * Get grouped attributes and values for a product
     */
    async apiProductV1ProductsAttributeslistList(requestParameters: ApiProductV1ProductsAttributeslistListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductGroupedAttributes> {
        const response = await this.apiProductV1ProductsAttributeslistListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Only the product owner (seller) can delete it.
     * Delete product
     */
    async apiProductV1ProductsDeleteRaw(requestParameters: ApiProductV1ProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsDelete.');
        }

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

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Only the product owner (seller) can delete it.
     * Delete product
     */
    async apiProductV1ProductsDelete(requestParameters: ApiProductV1ProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiProductV1ProductsDeleteRaw(requestParameters, initOverrides);
    }

    /**
     * Create product with attributes and variants
     */
    async apiProductV1ProductsFullCreateCreateRaw(requestParameters: ApiProductV1ProductsFullCreateCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductDetail>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductsFullCreateCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create product with attributes and variants
     */
    async apiProductV1ProductsFullCreateCreate(requestParameters: ApiProductV1ProductsFullCreateCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductDetail> {
        const response = await this.apiProductV1ProductsFullCreateCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Returns `is_owner=true` if the authenticated user is the seller of the given product.
     * Check if the user owns the product
     */
    async apiProductV1ProductsIsOwnerListRaw(requestParameters: ApiProductV1ProductsIsOwnerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductOwnershipCheck>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsIsOwnerList.');
        }

        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/product/v1/products/{id}/is-owner/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Returns `is_owner=true` if the authenticated user is the seller of the given product.
     * Check if the user owns the product
     */
    async apiProductV1ProductsIsOwnerList(requestParameters: ApiProductV1ProductsIsOwnerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductOwnershipCheck> {
        const response = await this.apiProductV1ProductsIsOwnerListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * List all active products. Supports filtering by category, price range, and seller.
     */
    async apiProductV1ProductsListRaw(requestParameters: ApiProductV1ProductsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Product>>> {
        const queryParameters: any = {};

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

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

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

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

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

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * List all active products. Supports filtering by category, price range, and seller.
     */
    async apiProductV1ProductsList(requestParameters: ApiProductV1ProductsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Product>> {
        const response = await this.apiProductV1ProductsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Only the seller who owns the product can update it. Accepts full structure like create: title, description, attributes, variants, etc.
     * Update product
     */
    async apiProductV1ProductsPartialUpdateRaw(requestParameters: ApiProductV1ProductsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductDetail>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsPartialUpdate.');
        }

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Only the seller who owns the product can update it. Accepts full structure like create: title, description, attributes, variants, etc.
     * Update product
     */
    async apiProductV1ProductsPartialUpdate(requestParameters: ApiProductV1ProductsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductDetail> {
        const response = await this.apiProductV1ProductsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get a product with its full details, including attributes and variants.
     * Retrieve product details
     */
    async apiProductV1ProductsReadRaw(requestParameters: ApiProductV1ProductsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductDetail>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsRead.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Get a product with its full details, including attributes and variants.
     * Retrieve product details
     */
    async apiProductV1ProductsRead(requestParameters: ApiProductV1ProductsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductDetail> {
        const response = await this.apiProductV1ProductsReadRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Create a new variant for a product.
     * Create product variant
     */
    async apiProductV1ProductsVariantsCreateRaw(requestParameters: ApiProductV1ProductsVariantsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductVariant>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsVariantsCreate.');
        }

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new variant for a product.
     * Create product variant
     */
    async apiProductV1ProductsVariantsCreate(requestParameters: ApiProductV1ProductsVariantsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductVariant> {
        const response = await this.apiProductV1ProductsVariantsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get all variants for a product.
     * List product variants
     */
    async apiProductV1ProductsVariantsListRaw(requestParameters: ApiProductV1ProductsVariantsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProductVariant>>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiProductV1ProductsVariantsList.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Get all variants for a product.
     * List product variants
     */
    async apiProductV1ProductsVariantsList(requestParameters: ApiProductV1ProductsVariantsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProductVariant>> {
        const response = await this.apiProductV1ProductsVariantsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Update **only** the stock of a product variant owned by the authenticated seller.  Body includes `variant_id` and the new `stock`.
     * Update variant stock (seller only)
     */
    async apiProductV1ProductsVariantsStockPartialUpdateRaw(requestParameters: ApiProductV1ProductsVariantsStockPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VariantStockUpdateResponse>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductsVariantsStockPartialUpdate.');
        }

        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/product/v1/products/variants/stock/`,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Update **only** the stock of a product variant owned by the authenticated seller.  Body includes `variant_id` and the new `stock`.
     * Update variant stock (seller only)
     */
    async apiProductV1ProductsVariantsStockPartialUpdate(requestParameters: ApiProductV1ProductsVariantsStockPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VariantStockUpdateResponse> {
        const response = await this.apiProductV1ProductsVariantsStockPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Update **only** the base price of a product owned by (or managed for) the authenticated seller.  Body includes `product_id` and the new `base_price`.
     * Update product base price (seller only)
     */
    async apiProductV1ProductsBasePricePartialUpdateRaw(requestParameters: ApiProductV1ProductsBasePricePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProductBasePriceUpdateResponse>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductsBasePricePartialUpdate.');
        }

        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/product/v1/products/base-price/`,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Update **only** the base price of a product owned by (or managed for) the authenticated seller.  Body includes `product_id` and the new `base_price`.
     * Update product base price (seller only)
     */
    async apiProductV1ProductsBasePricePartialUpdate(requestParameters: ApiProductV1ProductsBasePricePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProductBasePriceUpdateResponse> {
        const response = await this.apiProductV1ProductsBasePricePartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Update **only** the per-variant price override of a product variant owned by (or managed for) the authenticated seller.  Body includes `variant_id` and the new `price` (or `null` to inherit the product base price).
     * Update variant price (seller only)
     */
    async apiProductV1ProductsVariantsPricePartialUpdateRaw(requestParameters: ApiProductV1ProductsVariantsPricePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VariantPriceUpdateResponse>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProductV1ProductsVariantsPricePartialUpdate.');
        }

        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/product/v1/products/variants/price/`,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Update **only** the per-variant price override of a product variant owned by (or managed for) the authenticated seller.  Body includes `variant_id` and the new `price` (or `null` to inherit the product base price).
     * Update variant price (seller only)
     */
    async apiProductV1ProductsVariantsPricePartialUpdate(requestParameters: ApiProductV1ProductsVariantsPricePartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VariantPriceUpdateResponse> {
        const response = await this.apiProductV1ProductsVariantsPricePartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Return the authenticated seller\'s products with full attributes & variants. Ordering is strictly stable:   - Products: -id (newest first)   - Variants: id (ascending)   - VariantAttributeMapping: id (ascending)
     * List seller-owned products (stable by id)
     */
    async apiProductV1SellerProductsListRaw(requestParameters: ApiProductV1SellerProductsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SellerProductListItem>>> {
        const queryParameters: any = {};

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

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Return the authenticated seller\'s products with full attributes & variants. Ordering is strictly stable:   - Products: -id (newest first)   - Variants: id (ascending)   - VariantAttributeMapping: id (ascending)
     * List seller-owned products (stable by id)
     */
    async apiProductV1SellerProductsList(requestParameters: ApiProductV1SellerProductsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SellerProductListItem>> {
        const response = await this.apiProductV1SellerProductsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
