"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoleFeatureQueryDto = exports.UpdatePlanFeatureSettingsDto = exports.UpdateRoleFeatureSettingsDto = exports.RoleFeatureSettingDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const client_1 = require("@prisma/client");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const feature_catalog_1 = require("../feature-catalog");
const swagger_docs_1 = require("../../common/swagger-docs");
class RoleFeatureSettingDto {
    feature;
    enabled;
}
exports.RoleFeatureSettingDto = RoleFeatureSettingDto;
__decorate([
    (0, swagger_1.ApiProperty)({
        enum: feature_catalog_1.FEATURE_KEYS,
        example: feature_catalog_1.FeatureKey.VISITOR_PASSES_CREATE,
        description: 'Feature key from GET /features/catalog.'
    }),
    (0, class_validator_1.IsEnum)(feature_catalog_1.FeatureKey),
    __metadata("design:type", String)
], RoleFeatureSettingDto.prototype, "feature", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ example: true, description: 'Whether the feature is enabled for the selected role and scope.' }),
    (0, class_validator_1.IsBoolean)(),
    __metadata("design:type", Boolean)
], RoleFeatureSettingDto.prototype, "enabled", void 0);
class UpdateRoleFeatureSettingsDto {
    estateId;
    settings;
}
exports.UpdateRoleFeatureSettingsDto = UpdateRoleFeatureSettingsDto;
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: swagger_docs_1.ESTATE_ID_EXAMPLE,
        description: 'Estate override scope. SUPER_ADMIN may omit for global settings. ESTATE_ADMIN may omit or use their own estateId.'
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], UpdateRoleFeatureSettingsDto.prototype, "estateId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        type: [RoleFeatureSettingDto],
        description: 'Feature enablement updates to upsert for this role.'
    }),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ArrayNotEmpty)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => RoleFeatureSettingDto),
    __metadata("design:type", Array)
], UpdateRoleFeatureSettingsDto.prototype, "settings", void 0);
class UpdatePlanFeatureSettingsDto {
    settings;
}
exports.UpdatePlanFeatureSettingsDto = UpdatePlanFeatureSettingsDto;
__decorate([
    (0, swagger_1.ApiProperty)({
        type: [RoleFeatureSettingDto],
        description: 'Feature toggles to apply to a subscription plan. Enabled=true inserts the feature; enabled=false removes it.'
    }),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ArrayNotEmpty)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => RoleFeatureSettingDto),
    __metadata("design:type", Array)
], UpdatePlanFeatureSettingsDto.prototype, "settings", void 0);
class RoleFeatureQueryDto {
    role;
    estateId;
}
exports.RoleFeatureQueryDto = RoleFeatureQueryDto;
__decorate([
    (0, swagger_1.ApiProperty)({ enum: client_1.UserRole, example: client_1.UserRole.RESIDENT, description: 'Role to inspect.' }),
    (0, class_validator_1.IsEnum)(client_1.UserRole),
    __metadata("design:type", String)
], RoleFeatureQueryDto.prototype, "role", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ example: swagger_docs_1.ESTATE_ID_EXAMPLE, description: 'Optional estate override scope.' }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RoleFeatureQueryDto.prototype, "estateId", void 0);
//# sourceMappingURL=feature-access.dto.js.map