"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.tool$metadataFieldsUpdateMetadataFieldDatasource = void 0;
const z = __importStar(require("zod"));
const metadataFieldsUpdateMetadataFieldDatasource_js_1 = require("../../funcs/metadataFieldsUpdateMetadataFieldDatasource.js");
const operations = __importStar(require("../../models/operations/index.js"));
const tools_js_1 = require("../tools.js");
const args = {
    externalId: z.string(),
    requestBody: operations.UpdateMetadataFieldDatasourceRequestBody$inboundSchema,
};
exports.tool$metadataFieldsUpdateMetadataFieldDatasource = {
    name: "update-metadata-datasource-values",
    description: `Purpose: Updates the predefined values available for enum and set metadata fields, allowing you to add new options, modify existing values, reorder choices, or activate/deactivate specific values without recreating the entire field.
Usage: Use this to maintain current option lists for categorical metadata fields, such as adding new product categories, reordering selection options, or temporarily disabling specific values. Essential for keeping enum/set fields relevant and well-organized.
Example request: {"values": [{"external_id": "electronics", "value": "Electronics", "position": 1, "state": "active"}, {"external_id": "clothing", "value": "Clothing & Apparel", "position": 2, "state": "active"}, {"external_id": "books", "value": "Books", "position": 3, "state": "inactive"}]}
Parameters: external_id(field identifier from URL path), values array containing: external_id(unique value identifier), value(display text), position(sort order), state(active/inactive status)
When Not to Use: Don't use for string/integer/date field types that don't have datasources. Avoid frequent updates to stable option lists. Be careful when deactivating values that are actively used in production.
Output: Returns updated datasource configuration: values array with external_id(unique identifier), value(display text), position(sort order), state(activation status), created_at(creation timestamp), updated_at(modification time)
Example output: {"values":[{"external_id":"electronics","value":"Electronics","position":1,"state":"active","updated_at":"2023-01-15T15:00:00Z"},{"external_id":"clothing","value":"Clothing & Apparel","position":2,"state":"active","updated_at":"2023-01-15T15:00:00Z"}]}
`,
    scopes: ["builder"],
    args,
    tool: async (client, args, ctx) => {
        const [result, apiCall] = await (0, metadataFieldsUpdateMetadataFieldDatasource_js_1.metadataFieldsUpdateMetadataFieldDatasource)(client, args.externalId, args.requestBody, { fetchOptions: { signal: ctx.signal } }).$inspect();
        if (!result.ok) {
            return {
                content: [{ type: "text", text: result.error.message }],
                isError: true,
            };
        }
        const value = result.value;
        return (0, tools_js_1.formatResult)(value, apiCall);
    },
};
//# sourceMappingURL=metadataFieldsUpdateMetadataFieldDatasource.js.map