"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntegrationDto = exports.SupersetIntegrationDto = exports.IntegrationConfigurationDtoProtobuf = exports.IntegrationConfigurationDto = void 0;
const index_js_1 = require("../metadata/index.js");
class IntegrationConfigurationDto {
    id;
    // Created date could be used for sorting
    created;
    integrationId;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    configuration; // DatasourceConfiguration;
    isDefault;
    // The profiles associated with this configuration.
    // This should be undefined or empty when isDefault is true.
    profileIds;
    profileNames;
    constructor({ id, created, integrationId, configuration, isDefault, profileIds, profileNames }) {
        this.id = id;
        this.created = created;
        this.integrationId = integrationId;
        this.configuration = configuration;
        this.isDefault = isDefault;
        this.profileIds = profileIds;
        this.profileNames = profileNames;
    }
}
exports.IntegrationConfigurationDto = IntegrationConfigurationDto;
// this is needed due to the migration from ts -> proto objects
// in this case, the configuration is less strict than the original class
class IntegrationConfigurationDtoProtobuf {
    id;
    // Created date could be used for sorting
    created;
    integrationId;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    configuration;
    isDefault;
    // The profiles associated with this configuration.
    // This should be undefined or empty when isDefault is true.
    profileIds;
    constructor({ id, created, integrationId, configuration, isDefault, profileIds }) {
        this.id = id;
        this.created = created;
        this.integrationId = integrationId;
        this.configuration = configuration;
        this.isDefault = isDefault;
        this.profileIds = profileIds;
    }
}
exports.IntegrationConfigurationDtoProtobuf = IntegrationConfigurationDtoProtobuf;
class IntegrationBaseDto {
    id;
    name;
    pluginId;
    organizationId;
    applicationId;
    isUserConfigured;
    demoIntegrationId;
    managedBy;
    // Mirrors the non-nullable `user_editable` integration column (default true). Required here so
    // consumers (e.g. the edit UI) never have to treat `undefined` as a third state; subclass
    // constructors default an absent value to true.
    userEditable;
}
class SupersetIntegrationDto extends IntegrationBaseDto {
    kind;
    created;
    updated;
    configurations;
    slug;
    ownerEmail;
    readOnly;
    editable;
    metadata;
    permissions;
    creator;
    enabledForV2;
    constructor({ id, created, updated, deactivated, name, pluginId, kind, organizationId, configurations, demoIntegrationId, isUserConfigured, ownerEmail, slug, readOnly, editable, permissions, creator, enabledForV2, applicationId, managedBy, userEditable }) {
        super();
        this.id = id;
        this.created = created;
        this.updated = updated;
        this.name = name;
        this.pluginId = pluginId;
        this.kind = kind;
        this.organizationId = organizationId;
        this.applicationId = applicationId;
        this.configurations = configurations;
        this.demoIntegrationId = demoIntegrationId;
        this.isUserConfigured = isUserConfigured;
        this.managedBy = managedBy;
        this.userEditable = userEditable ?? true;
        this.ownerEmail = ownerEmail;
        this.slug = slug;
        this.readOnly = readOnly;
        this.editable = editable;
        this.metadata = (0, index_js_1.buildCommonMetadata)({
            id: id,
            organization: organizationId,
            type: 'integration',
            timestamp: {
                created: created,
                updated: updated,
                deactivated: deactivated
            }
        });
        this.permissions = permissions;
        this.creator = creator;
        this.enabledForV2 = enabledForV2;
    }
}
exports.SupersetIntegrationDto = SupersetIntegrationDto;
class IntegrationDto extends IntegrationBaseDto {
    kind;
    // Dates could be used for sorting
    created;
    updated;
    configurations;
    slug;
    ownerEmail;
    creator;
    enabledForV2;
    constructor({ id, created, updated, name, pluginId, organizationId, configurations, demoIntegrationId, isUserConfigured, ownerEmail, creator, kind, slug, enabledForV2, applicationId, managedBy, userEditable }) {
        super();
        this.id = id;
        this.created = created;
        this.updated = updated;
        this.name = name;
        this.pluginId = pluginId;
        this.organizationId = organizationId;
        this.applicationId = applicationId;
        this.demoIntegrationId = demoIntegrationId;
        this.configurations = configurations;
        this.isUserConfigured = isUserConfigured;
        this.managedBy = managedBy;
        this.userEditable = userEditable ?? true;
        this.ownerEmail = ownerEmail;
        this.creator = creator;
        this.kind = kind;
        this.slug = slug;
        this.enabledForV2 = enabledForV2;
    }
}
exports.IntegrationDto = IntegrationDto;
//# sourceMappingURL=index.js.map