/* 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 {
  SellerCourierCreate,
  SellerCourierDeleteResponse,
  SellerCourierList,
  SellerCourierUpdate,
} from '../models';

export interface ApiOrderV1SellerCouriersCreateRequest {
    data: SellerCourierCreate;
}

export interface ApiOrderV1SellerCouriersDeleteDeleteRequest {
    id: string;
}

export interface ApiOrderV1SellerCouriersPartialUpdateRequest {
    id: string;
    data: SellerCourierUpdate;
}

export interface ApiOrderV1SellerCouriersSellerListRequest {
    seller: string;
}

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

    /**
     * Allows a seller to define courier options for their store.
     * Define seller courier
     */
    async apiOrderV1SellerCouriersCreateRaw(requestParameters: ApiOrderV1SellerCouriersCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCourierCreate>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiOrderV1SellerCouriersCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Allows a seller to define courier options for their store.
     * Define seller courier
     */
    async apiOrderV1SellerCouriersCreate(requestParameters: ApiOrderV1SellerCouriersCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCourierCreate> {
        const response = await this.apiOrderV1SellerCouriersCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Allows a seller to remove a courier option from their store.
     * Delete a seller courier
     */
    async apiOrderV1SellerCouriersDeleteDeleteRaw(requestParameters: ApiOrderV1SellerCouriersDeleteDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCourierDeleteResponse>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiOrderV1SellerCouriersDeleteDelete.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Allows a seller to remove a courier option from their store.
     * Delete a seller courier
     */
    async apiOrderV1SellerCouriersDeleteDelete(requestParameters: ApiOrderV1SellerCouriersDeleteDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCourierDeleteResponse> {
        const response = await this.apiOrderV1SellerCouriersDeleteDeleteRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Allows the seller to update delivery price, estimated days, or enable/disable a courier.
     * Update seller courier settings
     */
    async apiOrderV1SellerCouriersPartialUpdateRaw(requestParameters: ApiOrderV1SellerCouriersPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCourierUpdate>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiOrderV1SellerCouriersPartialUpdate.');
        }

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Allows the seller to update delivery price, estimated days, or enable/disable a courier.
     * Update seller courier settings
     */
    async apiOrderV1SellerCouriersPartialUpdate(requestParameters: ApiOrderV1SellerCouriersPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCourierUpdate> {
        const response = await this.apiOrderV1SellerCouriersPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Returns all enabled couriers configured by a given seller.
     * List seller couriers
     */
    async apiOrderV1SellerCouriersSellerListRaw(requestParameters: ApiOrderV1SellerCouriersSellerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SellerCourierList>>> {
        if (requestParameters.seller === null || requestParameters.seller === undefined) {
            throw new runtime.RequiredError('seller','Required parameter requestParameters.seller was null or undefined when calling apiOrderV1SellerCouriersSellerList.');
        }

        const queryParameters: any = {};

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Returns all enabled couriers configured by a given seller.
     * List seller couriers
     */
    async apiOrderV1SellerCouriersSellerList(requestParameters: ApiOrderV1SellerCouriersSellerListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SellerCourierList>> {
        const response = await this.apiOrderV1SellerCouriersSellerListRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
