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