"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.Connector$inboundSchema = exports.TlsSupport$inboundSchema = exports.UnifiedApis$inboundSchema = exports.ConnectorOauthScopes$inboundSchema = exports.OauthScopes$inboundSchema = exports.OauthCredentialsSource$inboundSchema = exports.ConnectorOauthGrantType$inboundSchema = exports.ConnectorAuthType$inboundSchema = exports.OauthCredentialsSource = exports.ConnectorOauthGrantType = exports.ConnectorAuthType = void 0;
exports.oauthScopesFromJSON = oauthScopesFromJSON;
exports.connectorOauthScopesFromJSON = connectorOauthScopesFromJSON;
exports.unifiedApisFromJSON = unifiedApisFromJSON;
exports.tlsSupportFromJSON = tlsSupportFromJSON;
exports.connectorFromJSON = connectorFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const connectordoc_js_1 = require("./connectordoc.js");
const connectorevent_js_1 = require("./connectorevent.js");
const connectorsetting_js_1 = require("./connectorsetting.js");
const connectorstatus_js_1 = require("./connectorstatus.js");
const linkedconnectorresource_js_1 = require("./linkedconnectorresource.js");
const schemasupport_js_1 = require("./schemasupport.js");
const unifiedapiid_js_1 = require("./unifiedapiid.js");
const webhooksupport_js_1 = require("./webhooksupport.js");
/**
 * Type of authorization used by the connector
 */
exports.ConnectorAuthType = {
    Oauth2: "oauth2",
    ApiKey: "apiKey",
    Basic: "basic",
    Custom: "custom",
    None: "none",
};
/**
 * OAuth grant type used by the connector. More info: https://oauth.net/2/grant-types
 */
exports.ConnectorOauthGrantType = {
    AuthorizationCode: "authorization_code",
    ClientCredentials: "client_credentials",
    Password: "password",
};
/**
 * Location of the OAuth client credentials. For most connectors the OAuth client credentials are stored on integration and managed by the application owner. For others they are stored on connection and managed by the consumer in Vault.
 */
exports.OauthCredentialsSource = {
    Integration: "integration",
    Connection: "connection",
};
/** @internal */
exports.ConnectorAuthType$inboundSchema = z.nativeEnum(exports.ConnectorAuthType);
/** @internal */
exports.ConnectorOauthGrantType$inboundSchema = z.nativeEnum(exports.ConnectorOauthGrantType);
/** @internal */
exports.OauthCredentialsSource$inboundSchema = z.nativeEnum(exports.OauthCredentialsSource);
/** @internal */
exports.OauthScopes$inboundSchema = z.object({
    id: z.string().optional(),
    label: z.string().optional(),
    default_apis: z.array(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "default_apis": "defaultApis",
    });
});
function oauthScopesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OauthScopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OauthScopes' from JSON`);
}
/** @internal */
exports.ConnectorOauthScopes$inboundSchema = z.object({
    id: z.string().optional(),
    label: z.string().optional(),
});
function connectorOauthScopesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ConnectorOauthScopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConnectorOauthScopes' from JSON`);
}
/** @internal */
exports.UnifiedApis$inboundSchema = z.object({
    id: unifiedapiid_js_1.UnifiedApiId$inboundSchema.optional(),
    name: z.string().optional(),
    auth_only: z.boolean().optional(),
    oauth_scopes: z.array(z.lazy(() => exports.ConnectorOauthScopes$inboundSchema))
        .optional(),
    supported_resources: z.array(linkedconnectorresource_js_1.LinkedConnectorResource$inboundSchema)
        .optional(),
    downstream_unsupported_resources: z.array(z.string()).optional(),
    supported_events: z.array(connectorevent_js_1.ConnectorEvent$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "auth_only": "authOnly",
        "oauth_scopes": "oauthScopes",
        "supported_resources": "supportedResources",
        "downstream_unsupported_resources": "downstreamUnsupportedResources",
        "supported_events": "supportedEvents",
    });
});
function unifiedApisFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UnifiedApis$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnifiedApis' from JSON`);
}
/** @internal */
exports.TlsSupport$inboundSchema = z.object({
    type: z.string().optional(),
    description: z.string().optional(),
});
function tlsSupportFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TlsSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TlsSupport' from JSON`);
}
/** @internal */
exports.Connector$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
    status: connectorstatus_js_1.ConnectorStatus$inboundSchema.optional(),
    description: z.nullable(z.string()).optional(),
    icon_url: z.string().optional(),
    logo_url: z.string().optional(),
    website_url: z.string().optional(),
    signup_url: z.string().optional(),
    partner_signup_url: z.string().optional(),
    free_trial_available: z.boolean().optional(),
    auth_type: exports.ConnectorAuthType$inboundSchema.optional(),
    auth_only: z.boolean().optional(),
    blind_mapped: z.boolean().optional(),
    oauth_grant_type: exports.ConnectorOauthGrantType$inboundSchema.optional(),
    oauth_credentials_source: exports.OauthCredentialsSource$inboundSchema.optional(),
    oauth_scopes: z.array(z.lazy(() => exports.OauthScopes$inboundSchema)).optional(),
    custom_scopes: z.boolean().optional(),
    has_sandbox_credentials: z.boolean().optional(),
    settings: z.array(connectorsetting_js_1.ConnectorSetting$inboundSchema).optional(),
    service_id: z.string().optional(),
    unified_apis: z.array(z.lazy(() => exports.UnifiedApis$inboundSchema)).optional(),
    supported_resources: z.array(linkedconnectorresource_js_1.LinkedConnectorResource$inboundSchema)
        .optional(),
    configurable_resources: z.array(z.string()).optional(),
    supported_events: z.array(connectorevent_js_1.ConnectorEvent$inboundSchema).optional(),
    webhook_support: webhooksupport_js_1.WebhookSupport$inboundSchema.optional(),
    schema_support: schemasupport_js_1.SchemaSupport$inboundSchema.optional(),
    docs: z.array(connectordoc_js_1.ConnectorDoc$inboundSchema).optional(),
    tls_support: z.lazy(() => exports.TlsSupport$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "icon_url": "iconUrl",
        "logo_url": "logoUrl",
        "website_url": "websiteUrl",
        "signup_url": "signupUrl",
        "partner_signup_url": "partnerSignupUrl",
        "free_trial_available": "freeTrialAvailable",
        "auth_type": "authType",
        "auth_only": "authOnly",
        "blind_mapped": "blindMapped",
        "oauth_grant_type": "oauthGrantType",
        "oauth_credentials_source": "oauthCredentialsSource",
        "oauth_scopes": "oauthScopes",
        "custom_scopes": "customScopes",
        "has_sandbox_credentials": "hasSandboxCredentials",
        "service_id": "serviceId",
        "unified_apis": "unifiedApis",
        "supported_resources": "supportedResources",
        "configurable_resources": "configurableResources",
        "supported_events": "supportedEvents",
        "webhook_support": "webhookSupport",
        "schema_support": "schemaSupport",
        "tls_support": "tlsSupport",
    });
});
function connectorFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Connector$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Connector' from JSON`);
}
//# sourceMappingURL=connector.js.map