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 { Entity, Index, ManyToOne, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
import { OptionalProps } from "@mikro-orm/core";
OptionalProps;
let Dictionary = class {
  constructor() {
    this.isSystem = false;
    this.isActive = true;
    this.managerVisibility = "default";
    this.entrySortMode = "label_asc";
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], Dictionary.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], Dictionary.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], Dictionary.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], Dictionary.prototype, "key", 2);
__decorateClass([
  Property({ type: "text" })
], Dictionary.prototype, "name", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], Dictionary.prototype, "description", 2);
__decorateClass([
  Property({ name: "is_system", type: "boolean", default: false })
], Dictionary.prototype, "isSystem", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], Dictionary.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "manager_visibility", type: "text", default: "default" })
], Dictionary.prototype, "managerVisibility", 2);
__decorateClass([
  Property({ name: "entry_sort_mode", type: "text", default: "label_asc" })
], Dictionary.prototype, "entrySortMode", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], Dictionary.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], Dictionary.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], Dictionary.prototype, "deletedAt", 2);
Dictionary = __decorateClass([
  Entity({ tableName: "dictionaries" }),
  Unique({ name: "dictionaries_scope_key_unique", properties: ["organizationId", "tenantId", "key"] })
], Dictionary);
OptionalProps;
let DictionaryEntry = class {
  constructor() {
    this.position = 0;
    this.isDefault = false;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], DictionaryEntry.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => Dictionary, { fieldName: "dictionary_id" })
], DictionaryEntry.prototype, "dictionary", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], DictionaryEntry.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], DictionaryEntry.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], DictionaryEntry.prototype, "value", 2);
__decorateClass([
  Property({ name: "normalized_value", type: "text" })
], DictionaryEntry.prototype, "normalizedValue", 2);
__decorateClass([
  Property({ type: "text" })
], DictionaryEntry.prototype, "label", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], DictionaryEntry.prototype, "color", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], DictionaryEntry.prototype, "icon", 2);
__decorateClass([
  Property({ type: "int", default: 0 })
], DictionaryEntry.prototype, "position", 2);
__decorateClass([
  Property({ name: "is_default", type: "boolean", default: false })
], DictionaryEntry.prototype, "isDefault", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], DictionaryEntry.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], DictionaryEntry.prototype, "updatedAt", 2);
DictionaryEntry = __decorateClass([
  Entity({ tableName: "dictionary_entries" }),
  Index({ name: "dictionary_entries_scope_idx", properties: ["dictionary", "organizationId", "tenantId"] }),
  Unique({ name: "dictionary_entries_unique", properties: ["dictionary", "organizationId", "tenantId", "normalizedValue"] })
], DictionaryEntry);
export {
  Dictionary,
  DictionaryEntry
};
//# sourceMappingURL=entities.js.map
