"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSiteSchema = void 0;
const tslib_1 = require("tslib");
const HubItemEntitySchema_1 = require("../../core/schemas/shared/HubItemEntitySchema");
const subschemas_1 = require("../../core/schemas/shared/subschemas");
const checkPermission_1 = require("../../permissions/checkPermission");
/**
 * defines the JSON schema for a Hub Site's editable fields
 */
const getSiteSchema = (siteId, context) => {
    // sites don't have slugs
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const _a = HubItemEntitySchema_1.HubItemEntitySchema.properties, { _slug } = _a, propertiesWithoutSlug = tslib_1.__rest(_a, ["_slug"]);
    const nameSchema = (0, checkPermission_1.checkPermission)("hub:environment:enterprise", context)
        .access
        ? subschemas_1.ENTERPRISE_SITE_ENTITY_NAME_SCHEMA
        : subschemas_1.SITE_ENTITY_NAME_SCHEMA;
    return Object.assign(Object.assign({ $async: true }, HubItemEntitySchema_1.HubItemEntitySchema), { properties: Object.assign(Object.assign({}, propertiesWithoutSlug), { name: nameSchema, _discussions: subschemas_1.ENTITY_IS_DISCUSSABLE_SCHEMA, telemetry: subschemas_1.PRIVACY_CONFIG_SCHEMA, _urlInfo: {
                type: "object",
                isUniqueDomain: { siteId },
                required: ["subdomain"],
                properties: {
                    subdomain: {
                        type: "string",
                        format: "slug",
                    },
                },
            } }) });
};
exports.getSiteSchema = getSiteSchema;
//# sourceMappingURL=SiteSchema.js.map