import { deserializeAutomateWorkflowsV2026R0 } from '../schemas/v2026R0/automateWorkflowsV2026R0.js';
import { serializeAutomateWorkflowStartRequestV2026R0 } from '../schemas/v2026R0/automateWorkflowStartRequestV2026R0.js';
import { NetworkSession } from '../networking/network.js';
import { FetchOptions } from '../networking/fetchOptions.js';
import { prepareParams } from '../internal/utils.js';
import { toString } from '../internal/utils.js';
export class GetAutomateWorkflowsV2026R0Optionals {
    headers = new GetAutomateWorkflowsV2026R0Headers({});
    cancellationToken = void 0;
    constructor(fields) {
        if (fields.headers !== undefined) {
            this.headers = fields.headers;
        }
        if (fields.cancellationToken !== undefined) {
            this.cancellationToken = fields.cancellationToken;
        }
    }
}
export class CreateAutomateWorkflowStartV2026R0Optionals {
    headers = new CreateAutomateWorkflowStartV2026R0Headers({});
    cancellationToken = void 0;
    constructor(fields) {
        if (fields.headers !== undefined) {
            this.headers = fields.headers;
        }
        if (fields.cancellationToken !== undefined) {
            this.cancellationToken = fields.cancellationToken;
        }
    }
}
export class GetAutomateWorkflowsV2026R0Headers {
    /**
     * Version header. */
    boxVersion = '2026.0';
    /**
     * Extra headers that will be included in the HTTP request. */
    extraHeaders = {};
    constructor(fields) {
        if (fields.boxVersion !== undefined) {
            this.boxVersion = fields.boxVersion;
        }
        if (fields.extraHeaders !== undefined) {
            this.extraHeaders = fields.extraHeaders;
        }
    }
}
export class CreateAutomateWorkflowStartV2026R0Headers {
    /**
     * Version header. */
    boxVersion = '2026.0';
    /**
     * Extra headers that will be included in the HTTP request. */
    extraHeaders = {};
    constructor(fields) {
        if (fields.boxVersion !== undefined) {
            this.boxVersion = fields.boxVersion;
        }
        if (fields.extraHeaders !== undefined) {
            this.extraHeaders = fields.extraHeaders;
        }
    }
}
export class AutomateWorkflowsManager {
    auth;
    networkSession = new NetworkSession({});
    constructor(fields) {
        if (fields.auth !== undefined) {
            this.auth = fields.auth;
        }
        if (fields.networkSession !== undefined) {
            this.networkSession = fields.networkSession;
        }
    }
    /**
     * Returns workflow actions from Automate for a folder, using the
     * `WORKFLOW` action category.
     * @param {GetAutomateWorkflowsV2026R0QueryParams} queryParams Query parameters of getAutomateWorkflowsV2026R0 method
     * @param {GetAutomateWorkflowsV2026R0OptionalsInput} optionalsInput
     * @returns {Promise<AutomateWorkflowsV2026R0>}
     */
    async getAutomateWorkflowsV2026R0(queryParams, optionalsInput = {}) {
        const optionals = new GetAutomateWorkflowsV2026R0Optionals({
            headers: optionalsInput.headers,
            cancellationToken: optionalsInput.cancellationToken,
        });
        const headers = optionals.headers;
        const cancellationToken = optionals.cancellationToken;
        const queryParamsMap = prepareParams({
            ['folder_id']: toString(queryParams.folderId),
            ['limit']: toString(queryParams.limit),
            ['marker']: toString(queryParams.marker),
        });
        const headersMap = prepareParams({
            ...{ ['box-version']: toString(headers.boxVersion) },
            ...headers.extraHeaders,
        });
        const response = await this.networkSession.networkClient.fetch(new FetchOptions({
            url: ''.concat(this.networkSession.baseUrls.baseUrl, '/2.0/automate_workflows'),
            method: 'GET',
            params: queryParamsMap,
            headers: headersMap,
            responseFormat: 'json',
            auth: this.auth,
            networkSession: this.networkSession,
            cancellationToken: cancellationToken,
        }));
        return {
            ...deserializeAutomateWorkflowsV2026R0(response.data),
            rawData: response.data,
        };
    }
    /**
       * Starts an Automate workflow manually by using a workflow action ID and file IDs.
       * @param {string} workflowId The ID of the workflow.
      Example: "12345"
       * @param {AutomateWorkflowStartRequestV2026R0} requestBody Request body of createAutomateWorkflowStartV2026R0 method
       * @param {CreateAutomateWorkflowStartV2026R0OptionalsInput} optionalsInput
       * @returns {Promise<undefined>}
       */
    async createAutomateWorkflowStartV2026R0(workflowId, requestBody, optionalsInput = {}) {
        const optionals = new CreateAutomateWorkflowStartV2026R0Optionals({
            headers: optionalsInput.headers,
            cancellationToken: optionalsInput.cancellationToken,
        });
        const headers = optionals.headers;
        const cancellationToken = optionals.cancellationToken;
        const headersMap = prepareParams({
            ...{ ['box-version']: toString(headers.boxVersion) },
            ...headers.extraHeaders,
        });
        const response = await this.networkSession.networkClient.fetch(new FetchOptions({
            url: ''.concat(this.networkSession.baseUrls.baseUrl, '/2.0/automate_workflows/', toString(workflowId), '/start'),
            method: 'POST',
            headers: headersMap,
            data: serializeAutomateWorkflowStartRequestV2026R0(requestBody),
            contentType: 'application/json',
            responseFormat: 'no_content',
            auth: this.auth,
            networkSession: this.networkSession,
            cancellationToken: cancellationToken,
        }));
        return void 0;
    }
}
//# sourceMappingURL=automateWorkflows.js.map