var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
import { OptionalProps } from "@mikro-orm/core";
import { Entity, Index, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
import { resolveDefaultAttachmentOcrEnabled } from "../lib/ocrConfig.js";
OptionalProps;
let AttachmentPartition = class {
  constructor() {
    this.storageDriver = "local";
    this.isPublic = false;
    this.requiresOcr = resolveDefaultAttachmentOcrEnabled();
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], AttachmentPartition.prototype, "id", 2);
__decorateClass([
  Property({ type: "text" })
], AttachmentPartition.prototype, "code", 2);
__decorateClass([
  Property({ type: "text" })
], AttachmentPartition.prototype, "title", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], AttachmentPartition.prototype, "description", 2);
__decorateClass([
  Property({ name: "storage_driver", type: "text", default: "local" })
], AttachmentPartition.prototype, "storageDriver", 2);
__decorateClass([
  Property({ name: "config_json", type: "json", nullable: true })
], AttachmentPartition.prototype, "configJson", 2);
__decorateClass([
  Property({ name: "is_public", type: "boolean", default: false })
], AttachmentPartition.prototype, "isPublic", 2);
__decorateClass([
  Property({ name: "requires_ocr", type: "boolean", default: resolveDefaultAttachmentOcrEnabled() })
], AttachmentPartition.prototype, "requiresOcr", 2);
__decorateClass([
  Property({ name: "ocr_model", type: "text", nullable: true })
], AttachmentPartition.prototype, "ocrModel", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid", nullable: true })
], AttachmentPartition.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid", nullable: true }),
  Index({ name: "attachment_partitions_tenant_idx" })
], AttachmentPartition.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], AttachmentPartition.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], AttachmentPartition.prototype, "updatedAt", 2);
AttachmentPartition = __decorateClass([
  Entity({ tableName: "attachment_partitions" }),
  Unique({ name: "attachment_partitions_code_unique", properties: ["code"] })
], AttachmentPartition);
OptionalProps;
let Attachment = class {
  constructor() {
    this.storageDriver = "local";
    this.content = null;
    this.createdAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], Attachment.prototype, "id", 2);
__decorateClass([
  Property({ name: "entity_id", type: "text" })
], Attachment.prototype, "entityId", 2);
__decorateClass([
  Property({ name: "record_id", type: "text" }),
  Index({ name: "attachments_entity_record_idx" })
], Attachment.prototype, "recordId", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid", nullable: true })
], Attachment.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid", nullable: true })
], Attachment.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "partition_code", type: "text" }),
  Index({ name: "attachments_partition_code_idx" })
], Attachment.prototype, "partitionCode", 2);
__decorateClass([
  Property({ name: "file_name", type: "text" })
], Attachment.prototype, "fileName", 2);
__decorateClass([
  Property({ name: "mime_type", type: "text" })
], Attachment.prototype, "mimeType", 2);
__decorateClass([
  Property({ name: "file_size", type: "int" })
], Attachment.prototype, "fileSize", 2);
__decorateClass([
  Property({ name: "storage_driver", type: "text", default: "local" })
], Attachment.prototype, "storageDriver", 2);
__decorateClass([
  Property({ name: "storage_path", type: "text" })
], Attachment.prototype, "storagePath", 2);
__decorateClass([
  Property({ name: "storage_metadata", type: "jsonb", nullable: true })
], Attachment.prototype, "storageMetadata", 2);
__decorateClass([
  Property({ name: "url", type: "text" })
], Attachment.prototype, "url", 2);
__decorateClass([
  Property({ name: "content", type: "text", nullable: true })
], Attachment.prototype, "content", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], Attachment.prototype, "createdAt", 2);
Attachment = __decorateClass([
  Entity({ tableName: "attachments" })
], Attachment);
export {
  Attachment,
  AttachmentPartition
};
//# sourceMappingURL=entities.js.map
