"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// index.ts
var index_exports = {};
__export(index_exports, {
  ActionErrorType: () => ActionErrorType,
  AutomationErrorType: () => AutomationErrorType,
  AutomationValidationErrorValidationErrorType: () => AutomationValidationErrorValidationErrorType,
  DeleteStatus: () => DeleteStatus,
  Domain: () => Domain,
  Language: () => Language,
  Namespace: () => Namespace,
  Operator: () => Operator,
  Origin: () => Origin,
  RequestedFields: () => RequestedFields,
  Severity: () => Severity,
  SiteCreatedContext: () => SiteCreatedContext,
  SortOrder: () => SortOrder,
  State: () => State,
  Status: () => Status,
  TimeUnit: () => TimeUnit,
  TriggerErrorType: () => TriggerErrorType,
  TriggerValidationErrorValidationErrorType: () => TriggerValidationErrorValidationErrorType,
  Type: () => Type,
  ValidationErrorSeverity: () => ValidationErrorSeverity,
  ValidationErrorType: () => ValidationErrorType,
  ValidationResultStatus: () => ValidationResultStatus,
  WebhookIdentityType: () => WebhookIdentityType,
  bulkCountAutomationsWithDrafts: () => bulkCountAutomationsWithDrafts4,
  bulkDeleteAutomations: () => bulkDeleteAutomations4,
  copyAutomation: () => copyAutomation4,
  createAutomation: () => createAutomation4,
  createAutomationFromTemplateId: () => createAutomationFromTemplateId4,
  createDraftAutomation: () => createDraftAutomation4,
  createDraftAutomationFromTemplateId: () => createDraftAutomationFromTemplateId4,
  createPreinstalledAutomation: () => createPreinstalledAutomation4,
  deleteAutomation: () => deleteAutomation4,
  deleteDraftAutomation: () => deleteDraftAutomation4,
  deletePreinstalledAutomation: () => deletePreinstalledAutomation4,
  generateActionInputMappingFromTemplate: () => generateActionInputMappingFromTemplate4,
  generatePreinstalledAutomation: () => generatePreinstalledAutomation4,
  getActionsQuotaInfo: () => getActionsQuotaInfo4,
  getAggregatedUsageInfo: () => getAggregatedUsageInfo4,
  getAutomation: () => getAutomation4,
  getAutomationRevision: () => getAutomationRevision4,
  getOrCreateDraftAutomation: () => getOrCreateDraftAutomation4,
  onAutomationCreated: () => onAutomationCreated2,
  onAutomationDeleted: () => onAutomationDeleted2,
  onAutomationUpdated: () => onAutomationUpdated2,
  publishDraftAutomation: () => publishDraftAutomation4,
  queryAutomations: () => queryAutomations4,
  queryAutomationsWithDrafts: () => queryAutomationsWithDrafts4,
  queryPreinstalledAutomations: () => queryPreinstalledAutomations4,
  queryPreinstalledAutomationsForApp: () => queryPreinstalledAutomationsForApp4,
  updateAutomation: () => updateAutomation4,
  updateDraftAutomation: () => updateDraftAutomation4,
  updatePreinstalledAutomation: () => updatePreinstalledAutomation4,
  utils: () => utils,
  validateAutomation: () => validateAutomation4,
  validateAutomationById: () => validateAutomationById4
});
module.exports = __toCommonJS(index_exports);

// src/automations-v2-automation-automations-v-2.public.ts
var import_rename_all_nested_keys2 = require("@wix/sdk-runtime/rename-all-nested-keys");
var import_timestamp3 = require("@wix/sdk-runtime/transformations/timestamp");
var import_transform_paths3 = require("@wix/sdk-runtime/transformations/transform-paths");
var import_sdk_types = require("@wix/sdk-types");

// src/automations-v2-automation-automations-v-2.universal.ts
var import_transform_error = require("@wix/sdk-runtime/transform-error");
var import_query_builder = require("@wix/sdk-runtime/query-builder");
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");

// src/automations-v2-automation-automations-v-2.http.ts
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
var import_field_mask = require("@wix/sdk-runtime/transformations/field-mask");
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
function resolveWixAutomationsV2AutomationsServiceUrl(opts) {
  const domainToMappings = {
    "manage._base_domain_": [
      {
        srcPath: "/automations-service",
        destPath: ""
      },
      {
        srcPath: "/_api/automations-service",
        destPath: "/api"
      }
    ],
    "platform.rise.ai": [
      {
        srcPath: "/v2/automations",
        destPath: ""
      }
    ],
    "www.wixapis.com": [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    "*.dev.wix-code.com": [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    _: [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    "payments.base44.com": [
      {
        srcPath: "/_api/automations-service",
        destPath: "/api"
      },
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ]
  };
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
}
function resolveWixAutomationsV2AutomationRevisionsServiceUrl(opts) {
  const domainToMappings = {
    "manage._base_domain_": [
      {
        srcPath: "/automations-service",
        destPath: ""
      },
      {
        srcPath: "/_api/automations-service",
        destPath: "/api"
      }
    ],
    "platform.rise.ai": [
      {
        srcPath: "/v2/automations",
        destPath: ""
      }
    ],
    "www.wixapis.com": [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    "*.dev.wix-code.com": [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    _: [
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ],
    "payments.base44.com": [
      {
        srcPath: "/_api/automations-service",
        destPath: "/api"
      },
      {
        srcPath: "/automations-service",
        destPath: ""
      }
    ]
  };
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
}
var PACKAGE_NAME = "@wix/auto_sdk_automations_automations-v-2";
function getAutomationRevision(payload) {
  function __getAutomationRevision({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "GET",
      methodFqn: "wix.automations.v2.AutomationRevisionsService.GetAutomationRevision",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationRevisionsServiceUrl({
        protoPath: "/v1/automation-revisions/{automationId}",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload),
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __getAutomationRevision;
}
function createAutomation(payload) {
  function __createAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CreateAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __createAutomation;
}
function createAutomationFromTemplateId(payload) {
  function __createAutomationFromTemplateId({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CreateAutomationFromTemplateId",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/from-template/{automationTemplateId}",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __createAutomationFromTemplateId;
}
function getAutomation(payload) {
  function __getAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "GET",
      methodFqn: "wix.automations.v2.AutomationsService.GetAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/{automationId}",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload),
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __getAutomation;
}
function updateAutomation(payload) {
  function __updateAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_field_mask.transformSDKFieldMaskToRESTFieldMask,
        paths: [{ path: "fieldMask" }]
      },
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "PATCH",
      methodFqn: "wix.automations.v2.AutomationsService.UpdateAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/{automation.id}",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __updateAutomation;
}
function deleteAutomation(payload) {
  function __deleteAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "DELETE",
      methodFqn: "wix.automations.v2.AutomationsService.DeleteAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/{automationId}",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload)
    };
    return metadata;
  }
  return __deleteAutomation;
}
function bulkDeleteAutomations(payload) {
  function __bulkDeleteAutomations({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.BulkDeleteAutomations",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/bulk/automations/delete",
        data: payload,
        host
      }),
      data: payload
    };
    return metadata;
  }
  return __bulkDeleteAutomations;
}
function createPreinstalledAutomation(payload) {
  function __createPreinstalledAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CreatePreinstalledAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automation",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __createPreinstalledAutomation;
}
function updatePreinstalledAutomation(payload) {
  function __updatePreinstalledAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "PATCH",
      methodFqn: "wix.automations.v2.AutomationsService.UpdatePreinstalledAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automation",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __updatePreinstalledAutomation;
}
function deletePreinstalledAutomation(payload) {
  function __deletePreinstalledAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "DELETE",
      methodFqn: "wix.automations.v2.AutomationsService.DeletePreinstalledAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automation/{componentId}",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload)
    };
    return metadata;
  }
  return __deletePreinstalledAutomation;
}
function generatePreinstalledAutomation(payload) {
  function __generatePreinstalledAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.GeneratePreinstalledAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automation/generate",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __generatePreinstalledAutomation;
}
function queryPreinstalledAutomationsForApp(payload) {
  function __queryPreinstalledAutomationsForApp({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.QueryPreinstalledAutomationsForApp",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automations/query",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automations.createdDate" },
            { path: "automations.updatedDate" },
            { path: "automations.draftUpdatedDate" },
            { path: "automations.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __queryPreinstalledAutomationsForApp;
}
function queryPreinstalledAutomations(payload) {
  function __queryPreinstalledAutomations({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.QueryPreinstalledAutomations",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/preinstalled-automations/global/query",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automations.createdDate" },
            { path: "automations.updatedDate" },
            { path: "automations.draftUpdatedDate" },
            { path: "automations.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __queryPreinstalledAutomations;
}
function queryAutomations(payload) {
  function __queryAutomations({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.QueryAutomations",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/query",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automations.createdDate" },
            { path: "automations.updatedDate" },
            { path: "automations.draftUpdatedDate" },
            { path: "automations.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __queryAutomations;
}
function getAggregatedUsageInfo(payload) {
  function __getAggregatedUsageInfo({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "GET",
      methodFqn: "wix.automations.v2.AutomationsService.GetAggregatedUsageInfo",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/usage",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload, true)
    };
    return metadata;
  }
  return __getAggregatedUsageInfo;
}
function copyAutomation(payload) {
  function __copyAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CopyAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/{automationId}/copy",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __copyAutomation;
}
function createDraftAutomation(payload) {
  function __createDraftAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CreateDraftAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __createDraftAutomation;
}
function createDraftAutomationFromTemplateId(payload) {
  function __createDraftAutomationFromTemplateId({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.CreateDraftAutomationFromTemplateId",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts/from-template/{automationTemplateId}",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __createDraftAutomationFromTemplateId;
}
function getOrCreateDraftAutomation(payload) {
  function __getOrCreateDraftAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.GetOrCreateDraftAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts/get-or-create/original-automation-id/{originalAutomationId}",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __getOrCreateDraftAutomation;
}
function updateDraftAutomation(payload) {
  function __updateDraftAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_field_mask.transformSDKFieldMaskToRESTFieldMask,
        paths: [{ path: "fieldMask" }]
      },
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "PATCH",
      methodFqn: "wix.automations.v2.AutomationsService.UpdateDraftAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts/{automation.id}",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __updateDraftAutomation;
}
function queryAutomationsWithDrafts(payload) {
  function __queryAutomationsWithDrafts({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.QueryAutomationsWithDrafts",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/query-with-drafts",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automations.createdDate" },
            { path: "automations.updatedDate" },
            { path: "automations.draftUpdatedDate" },
            { path: "automations.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __queryAutomationsWithDrafts;
}
function bulkCountAutomationsWithDrafts(payload) {
  function __bulkCountAutomationsWithDrafts({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.BulkCountAutomationsWithDrafts",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/bulk-count-with-drafts",
        data: payload,
        host
      }),
      data: payload
    };
    return metadata;
  }
  return __bulkCountAutomationsWithDrafts;
}
function deleteDraftAutomation(payload) {
  function __deleteDraftAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "DELETE",
      methodFqn: "wix.automations.v2.AutomationsService.DeleteDraftAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts/{automationId}",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload)
    };
    return metadata;
  }
  return __deleteDraftAutomation;
}
function publishDraftAutomation(payload) {
  function __publishDraftAutomation({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.PublishDraftAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/drafts/{automationId}/publish",
        data: payload,
        host
      }),
      data: payload,
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            { path: "automation.createdDate" },
            { path: "automation.updatedDate" },
            { path: "automation.draftUpdatedDate" },
            { path: "automation.autoArchivePolicy.archiveDate" }
          ]
        }
      ])
    };
    return metadata;
  }
  return __publishDraftAutomation;
}
function validateAutomation(payload) {
  function __validateAutomation({ host }) {
    const serializedData = (0, import_transform_paths.transformPaths)(payload, [
      {
        transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
        paths: [
          { path: "automation.createdDate" },
          { path: "automation.updatedDate" },
          { path: "automation.draftUpdatedDate" },
          { path: "automation.autoArchivePolicy.archiveDate" }
        ]
      }
    ]);
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.ValidateAutomation",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/validate",
        data: serializedData,
        host
      }),
      data: serializedData
    };
    return metadata;
  }
  return __validateAutomation;
}
function validateAutomationById(payload) {
  function __validateAutomationById({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.ValidateAutomationById",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/{automationId}/validate",
        data: payload,
        host
      }),
      data: payload
    };
    return metadata;
  }
  return __validateAutomationById;
}
function getActionsQuotaInfo(payload) {
  function __getActionsQuotaInfo({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "GET",
      methodFqn: "wix.automations.v2.AutomationsService.GetActionsQuotaInfo",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/actions/quota",
        data: payload,
        host
      }),
      params: (0, import_rest_modules.toURLSearchParams)(payload),
      transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
        {
          transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
          paths: [
            {
              path: "actionProviderQuotaInfo.actionQuotaInfo.quotaInfo.quotas.renewalDate"
            }
          ]
        }
      ])
    };
    return metadata;
  }
  return __getActionsQuotaInfo;
}
function generateActionInputMappingFromTemplate(payload) {
  function __generateActionInputMappingFromTemplate({ host }) {
    const metadata = {
      entityFqdn: "wix.automations.v2.automation",
      method: "POST",
      methodFqn: "wix.automations.v2.AutomationsService.GenerateActionInputMappingFromTemplate",
      packageName: PACKAGE_NAME,
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveWixAutomationsV2AutomationsServiceUrl({
        protoPath: "/v2/automations/actions/generate-action-input-mapping-from-template",
        data: payload,
        host
      }),
      data: payload
    };
    return metadata;
  }
  return __generateActionInputMappingFromTemplate;
}

// src/automations-v2-automation-automations-v-2.universal.ts
var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
var import_query_builder_utils = require("@wix/sdk-runtime/query-builder-utils");
var Domain = /* @__PURE__ */ ((Domain2) => {
  Domain2["USER"] = "USER";
  Domain2["WIX"] = "WIX";
  Domain2["WIX_ACCOUNT"] = "WIX_ACCOUNT";
  return Domain2;
})(Domain || {});
var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
  TimeUnit2["MINUTES"] = "MINUTES";
  TimeUnit2["HOURS"] = "HOURS";
  TimeUnit2["DAYS"] = "DAYS";
  TimeUnit2["WEEKS"] = "WEEKS";
  TimeUnit2["MONTHS"] = "MONTHS";
  return TimeUnit2;
})(TimeUnit || {});
var Operator = /* @__PURE__ */ ((Operator2) => {
  Operator2["OR"] = "OR";
  Operator2["AND"] = "AND";
  return Operator2;
})(Operator || {});
var Language = /* @__PURE__ */ ((Language2) => {
  Language2["JAVASCRIPT"] = "JAVASCRIPT";
  return Language2;
})(Language || {});
var Type = /* @__PURE__ */ ((Type2) => {
  Type2["APP_DEFINED"] = "APP_DEFINED";
  Type2["CONDITION"] = "CONDITION";
  Type2["CODE_CONDITION"] = "CODE_CONDITION";
  Type2["DELAY"] = "DELAY";
  Type2["RATE_LIMIT"] = "RATE_LIMIT";
  return Type2;
})(Type || {});
var Status = /* @__PURE__ */ ((Status2) => {
  Status2["ACTIVE"] = "ACTIVE";
  Status2["INACTIVE"] = "INACTIVE";
  return Status2;
})(Status || {});
var Origin = /* @__PURE__ */ ((Origin2) => {
  Origin2["USER"] = "USER";
  Origin2["APPLICATION"] = "APPLICATION";
  Origin2["PREINSTALLED"] = "PREINSTALLED";
  return Origin2;
})(Origin || {});
var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
  WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
  WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
  WebhookIdentityType2["MEMBER"] = "MEMBER";
  WebhookIdentityType2["WIX_USER"] = "WIX_USER";
  WebhookIdentityType2["APP"] = "APP";
  return WebhookIdentityType2;
})(WebhookIdentityType || {});
var RequestedFields = /* @__PURE__ */ ((RequestedFields2) => {
  RequestedFields2["OVERRIDE_SCHEMA"] = "OVERRIDE_SCHEMA";
  return RequestedFields2;
})(RequestedFields || {});
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  SortOrder2["ASC"] = "ASC";
  SortOrder2["DESC"] = "DESC";
  return SortOrder2;
})(SortOrder || {});
var State = /* @__PURE__ */ ((State2) => {
  State2["UNKNOWN"] = "UNKNOWN";
  State2["ENABLED"] = "ENABLED";
  State2["DISABLED"] = "DISABLED";
  State2["PENDING"] = "PENDING";
  State2["DEMO"] = "DEMO";
  return State2;
})(State || {});
var SiteCreatedContext = /* @__PURE__ */ ((SiteCreatedContext2) => {
  SiteCreatedContext2["OTHER"] = "OTHER";
  SiteCreatedContext2["FROM_TEMPLATE"] = "FROM_TEMPLATE";
  SiteCreatedContext2["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
  SiteCreatedContext2["DUPLICATE"] = "DUPLICATE";
  SiteCreatedContext2["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
  SiteCreatedContext2["FLASH"] = "FLASH";
  return SiteCreatedContext2;
})(SiteCreatedContext || {});
var Namespace = /* @__PURE__ */ ((Namespace2) => {
  Namespace2["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
  Namespace2["WIX"] = "WIX";
  Namespace2["SHOUT_OUT"] = "SHOUT_OUT";
  Namespace2["ALBUMS"] = "ALBUMS";
  Namespace2["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
  Namespace2["HOTELS"] = "HOTELS";
  Namespace2["CLUBS"] = "CLUBS";
  Namespace2["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
  Namespace2["DEV_SITE"] = "DEV_SITE";
  Namespace2["LOGOS"] = "LOGOS";
  Namespace2["VIDEO_MAKER"] = "VIDEO_MAKER";
  Namespace2["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
  Namespace2["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
  Namespace2["HTML_DRAFT"] = "HTML_DRAFT";
  Namespace2["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
  Namespace2["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
  Namespace2["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
  Namespace2["ANYWHERE"] = "ANYWHERE";
  Namespace2["HEADLESS"] = "HEADLESS";
  Namespace2["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
  Namespace2["RISE"] = "RISE";
  Namespace2["BRANDED_FIRST"] = "BRANDED_FIRST";
  Namespace2["NOWNIA"] = "NOWNIA";
  Namespace2["UGC_TEMPLATE"] = "UGC_TEMPLATE";
  Namespace2["CODUX"] = "CODUX";
  Namespace2["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
  Namespace2["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
  Namespace2["STANDALONE_FORMS"] = "STANDALONE_FORMS";
  Namespace2["STANDALONE_EVENTS"] = "STANDALONE_EVENTS";
  Namespace2["MIMIR"] = "MIMIR";
  Namespace2["TWINS"] = "TWINS";
  Namespace2["NANO"] = "NANO";
  Namespace2["BASE44"] = "BASE44";
  Namespace2["CHANNELS"] = "CHANNELS";
  Namespace2["NAUTILUS"] = "NAUTILUS";
  Namespace2["SYMPHONY"] = "SYMPHONY";
  return Namespace2;
})(Namespace || {});
var DeleteStatus = /* @__PURE__ */ ((DeleteStatus2) => {
  DeleteStatus2["UNKNOWN"] = "UNKNOWN";
  DeleteStatus2["TRASH"] = "TRASH";
  DeleteStatus2["DELETED"] = "DELETED";
  DeleteStatus2["PENDING_PURGE"] = "PENDING_PURGE";
  DeleteStatus2["PURGED_EXTERNALLY"] = "PURGED_EXTERNALLY";
  return DeleteStatus2;
})(DeleteStatus || {});
var ValidationResultStatus = /* @__PURE__ */ ((ValidationResultStatus2) => {
  ValidationResultStatus2["VALID"] = "VALID";
  ValidationResultStatus2["VALID_WITH_WARNINGS"] = "VALID_WITH_WARNINGS";
  ValidationResultStatus2["INVALID"] = "INVALID";
  return ValidationResultStatus2;
})(ValidationResultStatus || {});
var TriggerValidationErrorValidationErrorType = /* @__PURE__ */ ((TriggerValidationErrorValidationErrorType2) => {
  TriggerValidationErrorValidationErrorType2["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
  TriggerValidationErrorValidationErrorType2["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
  TriggerValidationErrorValidationErrorType2["PROVIDER_ERROR"] = "PROVIDER_ERROR";
  return TriggerValidationErrorValidationErrorType2;
})(TriggerValidationErrorValidationErrorType || {});
var TriggerErrorType = /* @__PURE__ */ ((TriggerErrorType2) => {
  TriggerErrorType2["UNKNOWN_TRIGGER_ERROR_TYPE"] = "UNKNOWN_TRIGGER_ERROR_TYPE";
  TriggerErrorType2["NOT_FOUND"] = "NOT_FOUND";
  TriggerErrorType2["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
  TriggerErrorType2["INVALID_TRIGGER_KEY"] = "INVALID_TRIGGER_KEY";
  TriggerErrorType2["INVALID_FILTER_FIELD_KEY"] = "INVALID_FILTER_FIELD_KEY";
  TriggerErrorType2["INVALID_FILTER_EXPRESSION"] = "INVALID_FILTER_EXPRESSION";
  TriggerErrorType2["MISSING_REQUIRED_FILTER"] = "MISSING_REQUIRED_FILTER";
  return TriggerErrorType2;
})(TriggerErrorType || {});
var ValidationErrorSeverity = /* @__PURE__ */ ((ValidationErrorSeverity2) => {
  ValidationErrorSeverity2["UNKNOWN_VALIDATION_ERROR_SEVERITY"] = "UNKNOWN_VALIDATION_ERROR_SEVERITY";
  ValidationErrorSeverity2["WARNING"] = "WARNING";
  ValidationErrorSeverity2["ERROR"] = "ERROR";
  return ValidationErrorSeverity2;
})(ValidationErrorSeverity || {});
var Severity = /* @__PURE__ */ ((Severity2) => {
  Severity2["UNKNOWN_SEVERITY"] = "UNKNOWN_SEVERITY";
  Severity2["WARNING"] = "WARNING";
  Severity2["CRITICAL"] = "CRITICAL";
  return Severity2;
})(Severity || {});
var ValidationErrorType = /* @__PURE__ */ ((ValidationErrorType2) => {
  ValidationErrorType2["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
  ValidationErrorType2["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
  ValidationErrorType2["PROVIDER_ERROR"] = "PROVIDER_ERROR";
  return ValidationErrorType2;
})(ValidationErrorType || {});
var ActionErrorType = /* @__PURE__ */ ((ActionErrorType2) => {
  ActionErrorType2["UNKNOWN_ACTION_ERROR_TYPE"] = "UNKNOWN_ACTION_ERROR_TYPE";
  ActionErrorType2["NOT_FOUND"] = "NOT_FOUND";
  ActionErrorType2["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
  ActionErrorType2["INVALID_ACTION_KEY"] = "INVALID_ACTION_KEY";
  ActionErrorType2["INVALID_MAPPING"] = "INVALID_MAPPING";
  ActionErrorType2["MAPPING_TYPE_MISMATCH"] = "MAPPING_TYPE_MISMATCH";
  ActionErrorType2["MAPPING_MISSING_REQUIRED_FIELD"] = "MAPPING_MISSING_REQUIRED_FIELD";
  ActionErrorType2["MAPPING_SCHEMA_MISMATCH"] = "MAPPING_SCHEMA_MISMATCH";
  ActionErrorType2["MAPPING_VARIABLE_MISSING_FROM_SCHEMA"] = "MAPPING_VARIABLE_MISSING_FROM_SCHEMA";
  ActionErrorType2["POST_ACTION_NOT_FOUND"] = "POST_ACTION_NOT_FOUND";
  return ActionErrorType2;
})(ActionErrorType || {});
var AutomationValidationErrorValidationErrorType = /* @__PURE__ */ ((AutomationValidationErrorValidationErrorType2) => {
  AutomationValidationErrorValidationErrorType2["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
  AutomationValidationErrorValidationErrorType2["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
  AutomationValidationErrorValidationErrorType2["PROVIDER_ERROR"] = "PROVIDER_ERROR";
  return AutomationValidationErrorValidationErrorType2;
})(AutomationValidationErrorValidationErrorType || {});
var AutomationErrorType = /* @__PURE__ */ ((AutomationErrorType2) => {
  return AutomationErrorType2;
})(AutomationErrorType || {});
async function getAutomationRevision2(automationId, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId,
    revision: options?.revision,
    fields: options?.fields
  });
  const reqOpts = getAutomationRevision(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automationId: "$[0]",
          revision: "$[1].revision",
          fields: "$[1].fields"
        },
        singleArgumentUnchanged: false
      },
      ["automationId", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function createAutomation2(automation) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation
  });
  const reqOpts = createAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automation: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automation"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function createAutomationFromTemplateId2(automationTemplateId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationTemplateId
  });
  const reqOpts = createAutomationFromTemplateId(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationTemplateId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationTemplateId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function getAutomation2(automationId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId
  });
  const reqOpts = getAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function updateAutomation2(_id, automation) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation: { ...automation, id: _id }
  });
  const reqOpts = updateAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: { automation: "$[1]" },
        explicitPathsToArguments: { "automation.id": "$[0]" },
        singleArgumentUnchanged: false
      },
      ["_id", "automation"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function deleteAutomation2(automationId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId
  });
  const reqOpts = deleteAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function bulkDeleteAutomations2(automationIds) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationIds
  });
  const reqOpts = bulkDeleteAutomations(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationIds: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationIds"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function createPreinstalledAutomation2(automation, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation,
    specInfo: options?.specInfo,
    originAutomationInfo: options?.originAutomationInfo,
    appId: options?.appId
  });
  const reqOpts = createPreinstalledAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automation: "$[0]",
          specInfo: "$[1].specInfo",
          originAutomationInfo: "$[1].originAutomationInfo",
          appId: "$[1].appId"
        },
        singleArgumentUnchanged: false
      },
      ["automation", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function updatePreinstalledAutomation2(automation, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation,
    specInfo: options?.specInfo,
    appId: options?.appId
  });
  const reqOpts = updatePreinstalledAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automation: "$[0]",
          specInfo: "$[1].specInfo",
          appId: "$[1].appId"
        },
        singleArgumentUnchanged: false
      },
      ["automation", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function deletePreinstalledAutomation2(componentId, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    componentId,
    specInfo: options?.specInfo,
    appId: options?.appId
  });
  const reqOpts = deletePreinstalledAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          componentId: "$[0]",
          specInfo: "$[1].specInfo",
          appId: "$[1].appId"
        },
        singleArgumentUnchanged: false
      },
      ["componentId", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function generatePreinstalledAutomation2(automation, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation,
    appId: options?.appId
  });
  const reqOpts = generatePreinstalledAutomation(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automation: "$[0]", appId: "$[1].appId" },
        singleArgumentUnchanged: false
      },
      ["automation", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function queryPreinstalledAutomationsForApp2(options) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    query: options?.query,
    appId: options?.appId
  });
  const reqOpts = queryPreinstalledAutomationsForApp(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { query: "$[0].query", appId: "$[0].appId" },
        singleArgumentUnchanged: false
      },
      ["options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function queryPreinstalledAutomations2(query) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ query });
  const reqOpts = queryPreinstalledAutomations(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { query: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["query"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
function queryAutomations2(options) {
  const { httpClient, sideEffects } = arguments[1];
  return (0, import_query_builder.queryBuilder)({
    func: async (payload) => {
      const reqOpts = queryAutomations({
        ...payload,
        ...options ?? {}
      });
      sideEffects?.onSiteCall?.();
      try {
        const result = await httpClient.request(reqOpts);
        sideEffects?.onSuccess?.(result);
        return result;
      } catch (err) {
        sideEffects?.onError?.(err);
        throw err;
      }
    },
    requestTransformer: (query) => {
      const args = [query, options];
      return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
        ...args?.[1],
        query: args?.[0]
      });
    },
    responseTransformer: ({ data }) => {
      const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
        (0, import_transform_paths2.transformPaths)(data, [])
      );
      return {
        items: transformedData?.automations,
        pagingMetadata: transformedData?.pagingMetadata
      };
    },
    errorTransformer: (err) => {
      const transformedError = (0, import_transform_error.transformError)(err, {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { query: "$[0]" },
        singleArgumentUnchanged: false
      });
      throw transformedError;
    },
    pagingMethod: "CURSOR",
    transformationPaths: {}
  });
}
async function typedQueryAutomations(query, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    query,
    ...options
  });
  const reqOpts = queryAutomations(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { query: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["query", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
var utils = {
  query: {
    ...(0, import_query_builder_utils.createQueryUtils)()
  }
};
async function getAggregatedUsageInfo2(options) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    filter: options?.filter
  });
  const reqOpts = getAggregatedUsageInfo(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { filter: "$[0].filter" },
        singleArgumentUnchanged: false
      },
      ["options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function copyAutomation2(automationId, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId,
    origin: options?.origin,
    automation: options?.automation
  });
  const reqOpts = copyAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automationId: "$[0]",
          origin: "$[1].origin",
          automation: "$[1].automation"
        },
        singleArgumentUnchanged: false
      },
      ["automationId", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function createDraftAutomation2(options) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation: options?.automation
  });
  const reqOpts = createDraftAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automation: "$[0].automation" },
        singleArgumentUnchanged: false
      },
      ["options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function createDraftAutomationFromTemplateId2(automationTemplateId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationTemplateId
  });
  const reqOpts = createDraftAutomationFromTemplateId(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationTemplateId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationTemplateId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function getOrCreateDraftAutomation2(originalAutomationId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    originalAutomationId
  });
  const reqOpts = getOrCreateDraftAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { originalAutomationId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["originalAutomationId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function updateDraftAutomation2(_id, automation) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation: { ...automation, id: _id }
  });
  const reqOpts = updateDraftAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: { automation: "$[1]" },
        explicitPathsToArguments: { "automation.id": "$[0]" },
        singleArgumentUnchanged: false
      },
      ["_id", "automation"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function queryAutomationsWithDrafts2(options) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    query: options?.query
  });
  const reqOpts = queryAutomationsWithDrafts(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { query: "$[0].query" },
        singleArgumentUnchanged: false
      },
      ["options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function bulkCountAutomationsWithDrafts2(options) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    filters: options?.filters
  });
  const reqOpts = bulkCountAutomationsWithDrafts(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { filters: "$[0].filters" },
        singleArgumentUnchanged: false
      },
      ["options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function deleteDraftAutomation2(automationId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId
  });
  const reqOpts = deleteDraftAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function publishDraftAutomation2(automationId) {
  const { httpClient, sideEffects } = arguments[1];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId
  });
  const reqOpts = publishDraftAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: { automationId: "$[0]" },
        singleArgumentUnchanged: false
      },
      ["automationId"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function validateAutomation2(automation, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automation,
    validationSettings: options?.validationSettings
  });
  const reqOpts = validateAutomation(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automation: "$[0]",
          validationSettings: "$[1].validationSettings"
        },
        singleArgumentUnchanged: false
      },
      ["automation", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function validateAutomationById2(automationId, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    automationId,
    validationSettings: options?.validationSettings
  });
  const reqOpts = validateAutomationById(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          automationId: "$[0]",
          validationSettings: "$[1].validationSettings"
        },
        singleArgumentUnchanged: false
      },
      ["automationId", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function getActionsQuotaInfo2() {
  const { httpClient, sideEffects } = arguments[0];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
  const reqOpts = getActionsQuotaInfo(payload);
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {},
        singleArgumentUnchanged: false
      },
      []
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}
async function generateActionInputMappingFromTemplate2(appId, options) {
  const { httpClient, sideEffects } = arguments[2];
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
    appId,
    actionKey: options?.actionKey,
    actionInputMappingTemplate: options?.actionInputMappingTemplate
  });
  const reqOpts = generateActionInputMappingFromTemplate(
    payload
  );
  sideEffects?.onSiteCall?.();
  try {
    const result = await httpClient.request(reqOpts);
    sideEffects?.onSuccess?.(result);
    return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
  } catch (err) {
    const transformedError = (0, import_transform_error.transformError)(
      err,
      {
        spreadPathsToArguments: {},
        explicitPathsToArguments: {
          appId: "$[0]",
          actionKey: "$[1].actionKey",
          actionInputMappingTemplate: "$[1].actionInputMappingTemplate"
        },
        singleArgumentUnchanged: false
      },
      ["appId", "options"]
    );
    sideEffects?.onError?.(err);
    throw transformedError;
  }
}

// src/automations-v2-automation-automations-v-2.public.ts
function getAutomationRevision3(httpClient) {
  return (automationId, options) => getAutomationRevision2(
    automationId,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function createAutomation3(httpClient) {
  return (automation) => createAutomation2(
    automation,
    // @ts-ignore
    { httpClient }
  );
}
function createAutomationFromTemplateId3(httpClient) {
  return (automationTemplateId) => createAutomationFromTemplateId2(
    automationTemplateId,
    // @ts-ignore
    { httpClient }
  );
}
function getAutomation3(httpClient) {
  return (automationId) => getAutomation2(
    automationId,
    // @ts-ignore
    { httpClient }
  );
}
function updateAutomation3(httpClient) {
  return (_id, automation) => updateAutomation2(
    _id,
    automation,
    // @ts-ignore
    { httpClient }
  );
}
function deleteAutomation3(httpClient) {
  return (automationId) => deleteAutomation2(
    automationId,
    // @ts-ignore
    { httpClient }
  );
}
function bulkDeleteAutomations3(httpClient) {
  return (automationIds) => bulkDeleteAutomations2(
    automationIds,
    // @ts-ignore
    { httpClient }
  );
}
function createPreinstalledAutomation3(httpClient) {
  return (automation, options) => createPreinstalledAutomation2(
    automation,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function updatePreinstalledAutomation3(httpClient) {
  return (automation, options) => updatePreinstalledAutomation2(
    automation,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function deletePreinstalledAutomation3(httpClient) {
  return (componentId, options) => deletePreinstalledAutomation2(
    componentId,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function generatePreinstalledAutomation3(httpClient) {
  return (automation, options) => generatePreinstalledAutomation2(
    automation,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function queryPreinstalledAutomationsForApp3(httpClient) {
  return (options) => queryPreinstalledAutomationsForApp2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function queryPreinstalledAutomations3(httpClient) {
  return (query) => queryPreinstalledAutomations2(
    query,
    // @ts-ignore
    { httpClient }
  );
}
function queryAutomations3(httpClient) {
  return (options) => queryAutomations2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function typedQueryAutomations2(httpClient) {
  return (query, options) => typedQueryAutomations(
    query,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function getAggregatedUsageInfo3(httpClient) {
  return (options) => getAggregatedUsageInfo2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function copyAutomation3(httpClient) {
  return (automationId, options) => copyAutomation2(
    automationId,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function createDraftAutomation3(httpClient) {
  return (options) => createDraftAutomation2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function createDraftAutomationFromTemplateId3(httpClient) {
  return (automationTemplateId) => createDraftAutomationFromTemplateId2(
    automationTemplateId,
    // @ts-ignore
    { httpClient }
  );
}
function getOrCreateDraftAutomation3(httpClient) {
  return (originalAutomationId) => getOrCreateDraftAutomation2(
    originalAutomationId,
    // @ts-ignore
    { httpClient }
  );
}
function updateDraftAutomation3(httpClient) {
  return (_id, automation) => updateDraftAutomation2(
    _id,
    automation,
    // @ts-ignore
    { httpClient }
  );
}
function queryAutomationsWithDrafts3(httpClient) {
  return (options) => queryAutomationsWithDrafts2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function bulkCountAutomationsWithDrafts3(httpClient) {
  return (options) => bulkCountAutomationsWithDrafts2(
    options,
    // @ts-ignore
    { httpClient }
  );
}
function deleteDraftAutomation3(httpClient) {
  return (automationId) => deleteDraftAutomation2(
    automationId,
    // @ts-ignore
    { httpClient }
  );
}
function publishDraftAutomation3(httpClient) {
  return (automationId) => publishDraftAutomation2(
    automationId,
    // @ts-ignore
    { httpClient }
  );
}
function validateAutomation3(httpClient) {
  return (automation, options) => validateAutomation2(
    automation,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function validateAutomationById3(httpClient) {
  return (automationId, options) => validateAutomationById2(
    automationId,
    options,
    // @ts-ignore
    { httpClient }
  );
}
function getActionsQuotaInfo3(httpClient) {
  return () => getActionsQuotaInfo2(
    // @ts-ignore
    { httpClient }
  );
}
function generateActionInputMappingFromTemplate3(httpClient) {
  return (appId, options) => generateActionInputMappingFromTemplate2(
    appId,
    options,
    // @ts-ignore
    { httpClient }
  );
}
var onAutomationCreated = (0, import_sdk_types.EventDefinition)(
  "wix.automations.v2.automation_created",
  true,
  (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
    (0, import_transform_paths3.transformPaths)(event, [
      {
        transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
        paths: [
          { path: "entity.createdDate" },
          { path: "entity.updatedDate" },
          { path: "entity.draftUpdatedDate" },
          { path: "entity.autoArchivePolicy.archiveDate" },
          { path: "metadata.eventTime" }
        ]
      }
    ])
  )
)();
var onAutomationDeleted = (0, import_sdk_types.EventDefinition)(
  "wix.automations.v2.automation_deleted",
  true,
  (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
    (0, import_transform_paths3.transformPaths)(event, [
      {
        transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
        paths: [
          { path: "entity.createdDate" },
          { path: "entity.updatedDate" },
          { path: "entity.draftUpdatedDate" },
          { path: "entity.autoArchivePolicy.archiveDate" },
          { path: "metadata.eventTime" }
        ]
      }
    ])
  )
)();
var onAutomationUpdated = (0, import_sdk_types.EventDefinition)(
  "wix.automations.v2.automation_updated",
  true,
  (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
    (0, import_transform_paths3.transformPaths)(event, [
      {
        transformFn: import_timestamp3.transformRESTTimestampToSDKTimestamp,
        paths: [
          { path: "entity.createdDate" },
          { path: "entity.updatedDate" },
          { path: "entity.draftUpdatedDate" },
          { path: "entity.autoArchivePolicy.archiveDate" },
          { path: "metadata.eventTime" },
          { path: "modifiedFields.createdDate" },
          { path: "modifiedFields.updatedDate" },
          { path: "modifiedFields.draftUpdatedDate" },
          { path: "modifiedFields.autoArchivePolicy.archiveDate" }
        ]
      }
    ])
  )
)();

// src/automations-v2-automation-automations-v-2.context.ts
var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
var import_query_method_router = require("@wix/sdk-runtime/query-method-router");
function customQueryAutomations(httpClient) {
  const router = (0, import_query_method_router.createQueryOverloadRouter)({
    builderQueryFunction: (options) => queryAutomations3(httpClient)(options),
    typedQueryFunction: (query, options) => typedQueryAutomations2(httpClient)(query, options),
    hasOptionsParameter: true
  });
  function overloadedQuery(queryOrOptions, options) {
    return router(...arguments);
  }
  return overloadedQuery;
}
var getAutomationRevision4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getAutomationRevision3);
var createAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createAutomation3);
var createAutomationFromTemplateId4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createAutomationFromTemplateId3);
var getAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getAutomation3);
var updateAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateAutomation3);
var deleteAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteAutomation3);
var bulkDeleteAutomations4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkDeleteAutomations3);
var createPreinstalledAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createPreinstalledAutomation3);
var updatePreinstalledAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updatePreinstalledAutomation3);
var deletePreinstalledAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deletePreinstalledAutomation3);
var generatePreinstalledAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(generatePreinstalledAutomation3);
var queryPreinstalledAutomationsForApp4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryPreinstalledAutomationsForApp3);
var queryPreinstalledAutomations4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryPreinstalledAutomations3);
var getAggregatedUsageInfo4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getAggregatedUsageInfo3);
var copyAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(copyAutomation3);
var createDraftAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createDraftAutomation3);
var createDraftAutomationFromTemplateId4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createDraftAutomationFromTemplateId3);
var getOrCreateDraftAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getOrCreateDraftAutomation3);
var updateDraftAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateDraftAutomation3);
var queryAutomationsWithDrafts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryAutomationsWithDrafts3);
var bulkCountAutomationsWithDrafts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkCountAutomationsWithDrafts3);
var deleteDraftAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteDraftAutomation3);
var publishDraftAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(publishDraftAutomation3);
var validateAutomation4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(validateAutomation3);
var validateAutomationById4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(validateAutomationById3);
var getActionsQuotaInfo4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getActionsQuotaInfo3);
var generateActionInputMappingFromTemplate4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(
  generateActionInputMappingFromTemplate3
);
var queryAutomations4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(customQueryAutomations);
var onAutomationCreated2 = (0, import_event_definition_modules.createEventModule)(
  onAutomationCreated
);
var onAutomationDeleted2 = (0, import_event_definition_modules.createEventModule)(
  onAutomationDeleted
);
var onAutomationUpdated2 = (0, import_event_definition_modules.createEventModule)(
  onAutomationUpdated
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ActionErrorType,
  AutomationErrorType,
  AutomationValidationErrorValidationErrorType,
  DeleteStatus,
  Domain,
  Language,
  Namespace,
  Operator,
  Origin,
  RequestedFields,
  Severity,
  SiteCreatedContext,
  SortOrder,
  State,
  Status,
  TimeUnit,
  TriggerErrorType,
  TriggerValidationErrorValidationErrorType,
  Type,
  ValidationErrorSeverity,
  ValidationErrorType,
  ValidationResultStatus,
  WebhookIdentityType,
  bulkCountAutomationsWithDrafts,
  bulkDeleteAutomations,
  copyAutomation,
  createAutomation,
  createAutomationFromTemplateId,
  createDraftAutomation,
  createDraftAutomationFromTemplateId,
  createPreinstalledAutomation,
  deleteAutomation,
  deleteDraftAutomation,
  deletePreinstalledAutomation,
  generateActionInputMappingFromTemplate,
  generatePreinstalledAutomation,
  getActionsQuotaInfo,
  getAggregatedUsageInfo,
  getAutomation,
  getAutomationRevision,
  getOrCreateDraftAutomation,
  onAutomationCreated,
  onAutomationDeleted,
  onAutomationUpdated,
  publishDraftAutomation,
  queryAutomations,
  queryAutomationsWithDrafts,
  queryPreinstalledAutomations,
  queryPreinstalledAutomationsForApp,
  updateAutomation,
  updateDraftAutomation,
  updatePreinstalledAutomation,
  utils,
  validateAutomation,
  validateAutomationById
});
//# sourceMappingURL=index.js.map