"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.FileEntity = exports.StorageProvider = exports.FileVisibility = exports.FileStatus = void 0;
const typeorm_1 = require("typeorm");
var FileStatus;
(function (FileStatus) {
    FileStatus["UPLOADING"] = "uploading";
    FileStatus["PROCESSING"] = "processing";
    FileStatus["READY"] = "ready";
    FileStatus["FAILED"] = "failed";
    FileStatus["DELETED"] = "deleted";
})(FileStatus || (exports.FileStatus = FileStatus = {}));
var FileVisibility;
(function (FileVisibility) {
    FileVisibility["PRIVATE"] = "private";
    FileVisibility["TENANT"] = "tenant";
    FileVisibility["PUBLIC"] = "public";
})(FileVisibility || (exports.FileVisibility = FileVisibility = {}));
var StorageProvider;
(function (StorageProvider) {
    StorageProvider["S3"] = "s3";
    StorageProvider["R2"] = "r2";
    StorageProvider["MINIO"] = "minio";
    StorageProvider["GCS"] = "gcs";
})(StorageProvider || (exports.StorageProvider = StorageProvider = {}));
let FileEntity = class FileEntity {
};
exports.FileEntity = FileEntity;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
    __metadata("design:type", String)
], FileEntity.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)('uuid'),
    (0, typeorm_1.Index)(),
    __metadata("design:type", String)
], FileEntity.prototype, "tenant_id", void 0);
__decorate([
    (0, typeorm_1.Column)('uuid'),
    (0, typeorm_1.Index)(),
    __metadata("design:type", String)
], FileEntity.prototype, "uploaded_by", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 255 }),
    __metadata("design:type", String)
], FileEntity.prototype, "filename", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 500 }),
    __metadata("design:type", String)
], FileEntity.prototype, "original_name", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 100 }),
    __metadata("design:type", String)
], FileEntity.prototype, "mime_type", void 0);
__decorate([
    (0, typeorm_1.Column)('bigint'),
    __metadata("design:type", Number)
], FileEntity.prototype, "size_bytes", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 100 }),
    __metadata("design:type", String)
], FileEntity.prototype, "bucket", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 1000 }),
    __metadata("design:type", String)
], FileEntity.prototype, "path", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: StorageProvider,
        enumName: 'storage_provider',
        default: StorageProvider.S3,
    }),
    __metadata("design:type", String)
], FileEntity.prototype, "provider", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: FileStatus,
        enumName: 'file_status',
        default: FileStatus.READY,
    }),
    __metadata("design:type", String)
], FileEntity.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: 'enum',
        enum: FileVisibility,
        enumName: 'visibility',
        default: FileVisibility.PRIVATE,
    }),
    __metadata("design:type", String)
], FileEntity.prototype, "visibility", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
    __metadata("design:type", Object)
], FileEntity.prototype, "metadata", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'jsonb', default: {} }),
    __metadata("design:type", Object)
], FileEntity.prototype, "thumbnails", void 0);
__decorate([
    (0, typeorm_1.Column)({ length: 100, default: 'files' }),
    __metadata("design:type", String)
], FileEntity.prototype, "folder", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
    __metadata("design:type", Date)
], FileEntity.prototype, "created_at", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
    __metadata("design:type", Date)
], FileEntity.prototype, "updated_at", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
    __metadata("design:type", Object)
], FileEntity.prototype, "deleted_at", void 0);
exports.FileEntity = FileEntity = __decorate([
    (0, typeorm_1.Entity)({ schema: 'storage', name: 'files' }),
    (0, typeorm_1.Index)(['tenant_id', 'folder']),
    (0, typeorm_1.Index)(['tenant_id', 'deleted_at'])
], FileEntity);
//# sourceMappingURL=file.entity.js.map