"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.FeatureFlag = exports.FlagScope = exports.FlagType = void 0;
const typeorm_1 = require("typeorm");
var FlagType;
(function (FlagType) {
    FlagType["BOOLEAN"] = "boolean";
    FlagType["STRING"] = "string";
    FlagType["NUMBER"] = "number";
    FlagType["JSON"] = "json";
})(FlagType || (exports.FlagType = FlagType = {}));
var FlagScope;
(function (FlagScope) {
    FlagScope["GLOBAL"] = "global";
    FlagScope["TENANT"] = "tenant";
    FlagScope["USER"] = "user";
    FlagScope["PLAN"] = "plan";
})(FlagScope || (exports.FlagScope = FlagScope = {}));
let FeatureFlag = class FeatureFlag {
};
exports.FeatureFlag = FeatureFlag;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], FeatureFlag.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 100, unique: true }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "key", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "description", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: FlagType,
        default: FlagType.BOOLEAN,
    }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "flag_type", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: FlagScope,
        default: FlagScope.GLOBAL,
    }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "scope", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
    __metadata("design:type", Object)
], FeatureFlag.prototype, "default_value", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'boolean', default: false }),
    __metadata("design:type", Boolean)
], FeatureFlag.prototype, "is_enabled", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
    __metadata("design:type", Object)
], FeatureFlag.prototype, "targeting_rules", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
    __metadata("design:type", Number)
], FeatureFlag.prototype, "rollout_percentage", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
    __metadata("design:type", String)
], FeatureFlag.prototype, "category", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
    __metadata("design:type", Object)
], FeatureFlag.prototype, "metadata", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ type: 'timestamp with time zone' }),
    __metadata("design:type", Date)
], FeatureFlag.prototype, "created_at", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ type: 'timestamp with time zone' }),
    __metadata("design:type", Date)
], FeatureFlag.prototype, "updated_at", void 0);
exports.FeatureFlag = FeatureFlag = __decorate([
    (0, typeorm_1.Entity)({ name: 'flags', schema: 'feature_flags' }),
    (0, typeorm_1.Index)(['key'], { unique: true }),
    (0, typeorm_1.Index)(['is_enabled'])
], FeatureFlag);
//# sourceMappingURL=feature-flag.entity.js.map