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 { Collection, OptionalProps } from "@mikro-orm/core";
import { Entity, Index, ManyToOne, OneToMany, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
OptionalProps;
let CatalogOptionSchemaTemplate = class {
  constructor() {
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogOptionSchemaTemplate.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogOptionSchemaTemplate.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogOptionSchemaTemplate.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogOptionSchemaTemplate.prototype, "name", 2);
__decorateClass([
  Property({ name: "code", type: "text" })
], CatalogOptionSchemaTemplate.prototype, "code", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogOptionSchemaTemplate.prototype, "description", 2);
__decorateClass([
  Property({ name: "schema", type: "jsonb" })
], CatalogOptionSchemaTemplate.prototype, "schema", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogOptionSchemaTemplate.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogOptionSchemaTemplate.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogOptionSchemaTemplate.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogOptionSchemaTemplate.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogOptionSchemaTemplate.prototype, "deletedAt", 2);
CatalogOptionSchemaTemplate = __decorateClass([
  Entity({ tableName: "catalog_product_option_schemas" }),
  Index({
    name: "catalog_product_option_schemas_scope_idx",
    properties: ["organizationId", "tenantId"]
  }),
  Unique({
    name: "catalog_product_option_schemas_code_unique",
    properties: ["organizationId", "tenantId", "code"]
  })
], CatalogOptionSchemaTemplate);
OptionalProps;
let CatalogProduct = class {
  constructor() {
    this.productType = "simple";
    this.defaultSalesUnitQuantity = "1";
    this.uomRoundingScale = 4;
    this.uomRoundingMode = "half_up";
    this.unitPriceEnabled = false;
    this.isExciseGood = false;
    this.requiresPrescription = false;
    this.containsLithiumBattery = false;
    this.requiresShipping = true;
    this.isQuoteOnly = false;
    this.isConfigurable = false;
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.variants = new Collection(this);
    this.offers = new Collection(this);
    this.categoryAssignments = new Collection(this);
    this.tagAssignments = new Collection(this);
    this.unitConversions = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProduct.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProduct.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProduct.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogProduct.prototype, "title", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProduct.prototype, "subtitle", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProduct.prototype, "description", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProduct.prototype, "sku", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProduct.prototype, "handle", 2);
__decorateClass([
  Property({ name: "tax_rate_id", type: "uuid", nullable: true })
], CatalogProduct.prototype, "taxRateId", 2);
__decorateClass([
  Property({ name: "tax_rate", type: "numeric", precision: 7, scale: 4, nullable: true })
], CatalogProduct.prototype, "taxRate", 2);
__decorateClass([
  Property({ name: "product_type", type: "text", default: "simple" })
], CatalogProduct.prototype, "productType", 2);
__decorateClass([
  Property({ name: "status_entry_id", type: "uuid", nullable: true })
], CatalogProduct.prototype, "statusEntryId", 2);
__decorateClass([
  Property({ name: "primary_currency_code", type: "text", nullable: true })
], CatalogProduct.prototype, "primaryCurrencyCode", 2);
__decorateClass([
  Property({ name: "default_unit", type: "text", nullable: true })
], CatalogProduct.prototype, "defaultUnit", 2);
__decorateClass([
  Property({ name: "default_sales_unit", type: "text", nullable: true })
], CatalogProduct.prototype, "defaultSalesUnit", 2);
__decorateClass([
  Property({ name: "default_sales_unit_quantity", type: "numeric", precision: 18, scale: 6, default: "1" })
], CatalogProduct.prototype, "defaultSalesUnitQuantity", 2);
__decorateClass([
  Property({ name: "uom_rounding_scale", type: "smallint", default: 4 })
], CatalogProduct.prototype, "uomRoundingScale", 2);
__decorateClass([
  Property({ name: "uom_rounding_mode", type: "text", default: "half_up" })
], CatalogProduct.prototype, "uomRoundingMode", 2);
__decorateClass([
  Property({ name: "unit_price_enabled", type: "boolean", default: false })
], CatalogProduct.prototype, "unitPriceEnabled", 2);
__decorateClass([
  Property({ name: "unit_price_reference_unit", type: "text", nullable: true })
], CatalogProduct.prototype, "unitPriceReferenceUnit", 2);
__decorateClass([
  Property({ name: "unit_price_base_quantity", type: "numeric", precision: 18, scale: 6, nullable: true })
], CatalogProduct.prototype, "unitPriceBaseQuantity", 2);
__decorateClass([
  Property({ name: "default_media_id", type: "uuid", nullable: true })
], CatalogProduct.prototype, "defaultMediaId", 2);
__decorateClass([
  Property({ name: "default_media_url", type: "text", nullable: true })
], CatalogProduct.prototype, "defaultMediaUrl", 2);
__decorateClass([
  Property({ name: "weight_value", type: "numeric", precision: 16, scale: 4, nullable: true })
], CatalogProduct.prototype, "weightValue", 2);
__decorateClass([
  Property({ name: "weight_unit", type: "text", nullable: true })
], CatalogProduct.prototype, "weightUnit", 2);
__decorateClass([
  Property({ name: "dimensions", type: "jsonb", nullable: true })
], CatalogProduct.prototype, "dimensions", 2);
__decorateClass([
  Property({ name: "country_of_origin_code", type: "text", nullable: true })
], CatalogProduct.prototype, "countryOfOriginCode", 2);
__decorateClass([
  Property({ name: "pkwiu_code", type: "text", nullable: true })
], CatalogProduct.prototype, "pkwiuCode", 2);
__decorateClass([
  Property({ name: "cn_code", type: "text", nullable: true })
], CatalogProduct.prototype, "cnCode", 2);
__decorateClass([
  Property({ name: "hs_code", type: "text", nullable: true })
], CatalogProduct.prototype, "hsCode", 2);
__decorateClass([
  Property({ name: "tax_classification_code", type: "text", nullable: true })
], CatalogProduct.prototype, "taxClassificationCode", 2);
__decorateClass([
  Property({ name: "gtu_codes", type: "text[]", nullable: true })
], CatalogProduct.prototype, "gtuCodes", 2);
__decorateClass([
  Property({ name: "age_min", type: "smallint", nullable: true })
], CatalogProduct.prototype, "ageMin", 2);
__decorateClass([
  Property({ name: "is_excise_good", type: "boolean", default: false })
], CatalogProduct.prototype, "isExciseGood", 2);
__decorateClass([
  Property({ name: "excise_category", type: "text", nullable: true })
], CatalogProduct.prototype, "exciseCategory", 2);
__decorateClass([
  Property({ name: "requires_prescription", type: "boolean", default: false })
], CatalogProduct.prototype, "requiresPrescription", 2);
__decorateClass([
  Property({ name: "hazmat_class", type: "text", nullable: true })
], CatalogProduct.prototype, "hazmatClass", 2);
__decorateClass([
  Property({ name: "un_number", type: "text", nullable: true })
], CatalogProduct.prototype, "unNumber", 2);
__decorateClass([
  Property({ name: "hazmat_packing_group", type: "text", nullable: true })
], CatalogProduct.prototype, "hazmatPackingGroup", 2);
__decorateClass([
  Property({ name: "contains_lithium_battery", type: "boolean", default: false })
], CatalogProduct.prototype, "containsLithiumBattery", 2);
__decorateClass([
  Property({ name: "launch_at", type: Date, nullable: true })
], CatalogProduct.prototype, "launchAt", 2);
__decorateClass([
  Property({ name: "end_of_life_at", type: Date, nullable: true })
], CatalogProduct.prototype, "endOfLifeAt", 2);
__decorateClass([
  Property({ name: "available_from", type: Date, nullable: true })
], CatalogProduct.prototype, "availableFrom", 2);
__decorateClass([
  Property({ name: "available_until", type: Date, nullable: true })
], CatalogProduct.prototype, "availableUntil", 2);
__decorateClass([
  Property({ name: "min_order_qty", type: "integer", nullable: true })
], CatalogProduct.prototype, "minOrderQty", 2);
__decorateClass([
  Property({ name: "max_order_qty", type: "integer", nullable: true })
], CatalogProduct.prototype, "maxOrderQty", 2);
__decorateClass([
  Property({ name: "order_qty_increment", type: "integer", nullable: true })
], CatalogProduct.prototype, "orderQtyIncrement", 2);
__decorateClass([
  Property({ name: "requires_shipping", type: "boolean", default: true })
], CatalogProduct.prototype, "requiresShipping", 2);
__decorateClass([
  Property({ name: "is_quote_only", type: "boolean", default: false })
], CatalogProduct.prototype, "isQuoteOnly", 2);
__decorateClass([
  Property({ name: "seo_title", type: "text", nullable: true })
], CatalogProduct.prototype, "seoTitle", 2);
__decorateClass([
  Property({ name: "seo_description", type: "text", nullable: true })
], CatalogProduct.prototype, "seoDescription", 2);
__decorateClass([
  Property({ name: "canonical_url", type: "text", nullable: true })
], CatalogProduct.prototype, "canonicalUrl", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProduct.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "custom_fieldset_code", type: "text", nullable: true })
], CatalogProduct.prototype, "customFieldsetCode", 2);
__decorateClass([
  ManyToOne(() => CatalogOptionSchemaTemplate, {
    fieldName: "option_schema_id",
    nullable: true,
    deleteRule: "set null"
  })
], CatalogProduct.prototype, "optionSchemaTemplate", 2);
__decorateClass([
  Property({ name: "is_configurable", type: "boolean", default: false })
], CatalogProduct.prototype, "isConfigurable", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogProduct.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProduct.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProduct.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogProduct.prototype, "deletedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductVariant, (variant) => variant.product)
], CatalogProduct.prototype, "variants", 2);
__decorateClass([
  OneToMany(() => CatalogOffer, (offer) => offer.product)
], CatalogProduct.prototype, "offers", 2);
__decorateClass([
  OneToMany(() => CatalogProductCategoryAssignment, (assignment) => assignment.product)
], CatalogProduct.prototype, "categoryAssignments", 2);
__decorateClass([
  OneToMany(() => CatalogProductTagAssignment, (assignment) => assignment.product)
], CatalogProduct.prototype, "tagAssignments", 2);
__decorateClass([
  OneToMany(() => CatalogProductUnitConversion, (conversion) => conversion.product)
], CatalogProduct.prototype, "unitConversions", 2);
CatalogProduct = __decorateClass([
  Entity({ tableName: "catalog_products" }),
  Index({ name: "catalog_products_org_tenant_idx", properties: ["organizationId", "tenantId"] }),
  Unique({ name: "catalog_products_sku_scope_unique", properties: ["organizationId", "tenantId", "sku"] }),
  Unique({ name: "catalog_products_handle_scope_unique", properties: ["organizationId", "tenantId", "handle"] })
], CatalogProduct);
OptionalProps;
let CatalogProductUnitConversion = class {
  constructor() {
    this.sortOrder = 0;
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductUnitConversion.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id", deleteRule: "cascade" })
], CatalogProductUnitConversion.prototype, "product", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductUnitConversion.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductUnitConversion.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "unit_code", type: "text" })
], CatalogProductUnitConversion.prototype, "unitCode", 2);
__decorateClass([
  Property({ name: "to_base_factor", type: "numeric", precision: 24, scale: 12 })
], CatalogProductUnitConversion.prototype, "toBaseFactor", 2);
__decorateClass([
  Property({ name: "sort_order", type: "integer", default: 0 })
], CatalogProductUnitConversion.prototype, "sortOrder", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogProductUnitConversion.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProductUnitConversion.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductUnitConversion.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductUnitConversion.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogProductUnitConversion.prototype, "deletedAt", 2);
CatalogProductUnitConversion = __decorateClass([
  Entity({ tableName: "catalog_product_unit_conversions" }),
  Index({
    name: "catalog_product_unit_conversions_scope_idx",
    properties: ["organizationId", "tenantId", "product"]
  }),
  Unique({
    name: "catalog_product_unit_conversions_unique",
    properties: ["product", "unitCode"]
  })
], CatalogProductUnitConversion);
OptionalProps;
let CatalogProductCategory = class {
  constructor() {
    this.depth = 0;
    this.ancestorIds = [];
    this.childIds = [];
    this.descendantIds = [];
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.assignments = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductCategory.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductCategory.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductCategory.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogProductCategory.prototype, "name", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductCategory.prototype, "slug", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductCategory.prototype, "description", 2);
__decorateClass([
  Property({ name: "parent_id", type: "uuid", nullable: true })
], CatalogProductCategory.prototype, "parentId", 2);
__decorateClass([
  Property({ name: "root_id", type: "uuid", nullable: true })
], CatalogProductCategory.prototype, "rootId", 2);
__decorateClass([
  Property({ name: "tree_path", type: "text", nullable: true })
], CatalogProductCategory.prototype, "treePath", 2);
__decorateClass([
  Property({ type: "int", default: 0 })
], CatalogProductCategory.prototype, "depth", 2);
__decorateClass([
  Property({ name: "ancestor_ids", type: "jsonb", default: [], nullable: false })
], CatalogProductCategory.prototype, "ancestorIds", 2);
__decorateClass([
  Property({ name: "child_ids", type: "jsonb", default: [], nullable: false })
], CatalogProductCategory.prototype, "childIds", 2);
__decorateClass([
  Property({ name: "descendant_ids", type: "jsonb", default: [], nullable: false })
], CatalogProductCategory.prototype, "descendantIds", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProductCategory.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogProductCategory.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductCategory.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductCategory.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogProductCategory.prototype, "deletedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductCategoryAssignment, (assignment) => assignment.category)
], CatalogProductCategory.prototype, "assignments", 2);
CatalogProductCategory = __decorateClass([
  Entity({ tableName: "catalog_product_categories" }),
  Index({ name: "catalog_product_categories_scope_idx", properties: ["organizationId", "tenantId"] }),
  Unique({ name: "catalog_product_categories_slug_unique", properties: ["organizationId", "tenantId", "slug"] })
], CatalogProductCategory);
OptionalProps;
let CatalogProductCategoryAssignment = class {
  constructor() {
    this.position = 0;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductCategoryAssignment.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id", deleteRule: "cascade" })
], CatalogProductCategoryAssignment.prototype, "product", 2);
__decorateClass([
  ManyToOne(() => CatalogProductCategory, { fieldName: "category_id", deleteRule: "cascade" })
], CatalogProductCategoryAssignment.prototype, "category", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductCategoryAssignment.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductCategoryAssignment.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "position", type: "int", default: 0 })
], CatalogProductCategoryAssignment.prototype, "position", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductCategoryAssignment.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductCategoryAssignment.prototype, "updatedAt", 2);
CatalogProductCategoryAssignment = __decorateClass([
  Entity({ tableName: "catalog_product_category_assignments" }),
  Index({
    name: "catalog_product_category_assignments_scope_idx",
    properties: ["organizationId", "tenantId"]
  }),
  Unique({
    name: "catalog_product_category_assignments_unique",
    properties: ["product", "category"]
  })
], CatalogProductCategoryAssignment);
OptionalProps;
let CatalogProductTag = class {
  constructor() {
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.assignments = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductTag.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductTag.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductTag.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogProductTag.prototype, "label", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogProductTag.prototype, "slug", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductTag.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductTag.prototype, "updatedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductTagAssignment, (assignment) => assignment.tag)
], CatalogProductTag.prototype, "assignments", 2);
CatalogProductTag = __decorateClass([
  Entity({ tableName: "catalog_product_tags" }),
  Index({ name: "catalog_product_tags_scope_idx", properties: ["organizationId", "tenantId"] }),
  Unique({ name: "catalog_product_tags_slug_unique", properties: ["organizationId", "tenantId", "slug"] })
], CatalogProductTag);
OptionalProps;
let CatalogProductTagAssignment = class {
  constructor() {
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductTagAssignment.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id", deleteRule: "cascade" })
], CatalogProductTagAssignment.prototype, "product", 2);
__decorateClass([
  ManyToOne(() => CatalogProductTag, { fieldName: "tag_id", deleteRule: "cascade" })
], CatalogProductTagAssignment.prototype, "tag", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductTagAssignment.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductTagAssignment.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductTagAssignment.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductTagAssignment.prototype, "updatedAt", 2);
CatalogProductTagAssignment = __decorateClass([
  Entity({ tableName: "catalog_product_tag_assignments" }),
  Index({ name: "catalog_product_tag_assignments_scope_idx", properties: ["organizationId", "tenantId"] }),
  Unique({ name: "catalog_product_tag_assignments_unique", properties: ["product", "tag"] })
], CatalogProductTagAssignment);
OptionalProps;
let CatalogOffer = class {
  constructor() {
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.prices = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogOffer.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id", deleteRule: "cascade" })
], CatalogOffer.prototype, "product", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogOffer.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogOffer.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "channel_id", type: "uuid" })
], CatalogOffer.prototype, "channelId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogOffer.prototype, "title", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogOffer.prototype, "description", 2);
__decorateClass([
  Property({ name: "default_media_id", type: "uuid", nullable: true })
], CatalogOffer.prototype, "defaultMediaId", 2);
__decorateClass([
  Property({ name: "default_media_url", type: "text", nullable: true })
], CatalogOffer.prototype, "defaultMediaUrl", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogOffer.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogOffer.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogOffer.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogOffer.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogOffer.prototype, "deletedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductPrice, (price) => price.offer)
], CatalogOffer.prototype, "prices", 2);
CatalogOffer = __decorateClass([
  Entity({ tableName: "catalog_product_offers" }),
  Index({ name: "catalog_product_offers_scope_idx", properties: ["organizationId", "tenantId"] }),
  Unique({
    name: "catalog_product_offers_product_channel_unique",
    properties: ["product", "organizationId", "tenantId", "channelId"]
  })
], CatalogOffer);
OptionalProps;
let CatalogProductVariant = class {
  constructor() {
    this.isDefault = false;
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.prices = new Collection(this);
    this.componentRelations = new Collection(this);
    this.parentRelations = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductVariant.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id" })
], CatalogProductVariant.prototype, "product", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductVariant.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductVariant.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductVariant.prototype, "name", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductVariant.prototype, "sku", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductVariant.prototype, "barcode", 2);
__decorateClass([
  Property({ name: "gtin_type", type: "text", nullable: true })
], CatalogProductVariant.prototype, "gtinType", 2);
__decorateClass([
  Property({ name: "hs_code", type: "text", nullable: true })
], CatalogProductVariant.prototype, "hsCode", 2);
__decorateClass([
  Property({ type: "text", nullable: true })
], CatalogProductVariant.prototype, "statusEntryId", 2);
__decorateClass([
  Property({ name: "is_default", type: "boolean", default: false })
], CatalogProductVariant.prototype, "isDefault", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogProductVariant.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "weight_value", type: "numeric", precision: 16, scale: 4, nullable: true })
], CatalogProductVariant.prototype, "weightValue", 2);
__decorateClass([
  Property({ name: "weight_unit", type: "text", nullable: true })
], CatalogProductVariant.prototype, "weightUnit", 2);
__decorateClass([
  Property({ name: "dimensions", type: "jsonb", nullable: true })
], CatalogProductVariant.prototype, "dimensions", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProductVariant.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "tax_rate_id", type: "uuid", nullable: true })
], CatalogProductVariant.prototype, "taxRateId", 2);
__decorateClass([
  Property({ name: "tax_rate", type: "numeric", precision: 7, scale: 4, nullable: true })
], CatalogProductVariant.prototype, "taxRate", 2);
__decorateClass([
  Property({ name: "option_values", type: "jsonb", nullable: true })
], CatalogProductVariant.prototype, "optionValues", 2);
__decorateClass([
  Property({ name: "default_media_id", type: "uuid", nullable: true })
], CatalogProductVariant.prototype, "defaultMediaId", 2);
__decorateClass([
  Property({ name: "default_media_url", type: "text", nullable: true })
], CatalogProductVariant.prototype, "defaultMediaUrl", 2);
__decorateClass([
  Property({ name: "custom_fieldset_code", type: "text", nullable: true })
], CatalogProductVariant.prototype, "customFieldsetCode", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductVariant.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductVariant.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogProductVariant.prototype, "deletedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductPrice, (price) => price.variant)
], CatalogProductVariant.prototype, "prices", 2);
__decorateClass([
  OneToMany(() => CatalogProductVariantRelation, (relation) => relation.parentVariant)
], CatalogProductVariant.prototype, "componentRelations", 2);
__decorateClass([
  OneToMany(() => CatalogProductVariantRelation, (relation) => relation.childVariant)
], CatalogProductVariant.prototype, "parentRelations", 2);
CatalogProductVariant = __decorateClass([
  Entity({ tableName: "catalog_product_variants" }),
  Index({ name: "catalog_product_variants_scope_idx", properties: ["product", "organizationId", "tenantId"] }),
  Unique({
    name: "catalog_product_variants_sku_unique",
    properties: ["organizationId", "tenantId", "sku"]
  }),
  Index({
    name: "catalog_product_variants_gtin_scope_unique",
    expression: `create unique index "catalog_product_variants_gtin_scope_unique" on "catalog_product_variants" ("tenant_id", "organization_id", "gtin_type", "barcode") where deleted_at is null and gtin_type is not null and barcode is not null`
  })
], CatalogProductVariant);
OptionalProps;
let CatalogProductVariantRelation = class {
  constructor() {
    this.relationType = "grouped";
    this.isRequired = false;
    this.position = 0;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductVariantRelation.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProductVariant, {
    fieldName: "parent_variant_id",
    deleteRule: "cascade"
  })
], CatalogProductVariantRelation.prototype, "parentVariant", 2);
__decorateClass([
  ManyToOne(() => CatalogProductVariant, {
    fieldName: "child_variant_id",
    deleteRule: "cascade",
    nullable: true
  })
], CatalogProductVariantRelation.prototype, "childVariant", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, {
    fieldName: "child_product_id",
    nullable: true,
    deleteRule: "cascade"
  })
], CatalogProductVariantRelation.prototype, "childProduct", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductVariantRelation.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductVariantRelation.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "relation_type", type: "text" })
], CatalogProductVariantRelation.prototype, "relationType", 2);
__decorateClass([
  Property({ name: "is_required", type: "boolean", default: false })
], CatalogProductVariantRelation.prototype, "isRequired", 2);
__decorateClass([
  Property({ name: "min_quantity", type: "integer", nullable: true })
], CatalogProductVariantRelation.prototype, "minQuantity", 2);
__decorateClass([
  Property({ name: "max_quantity", type: "integer", nullable: true })
], CatalogProductVariantRelation.prototype, "maxQuantity", 2);
__decorateClass([
  Property({ type: "integer", default: 0 })
], CatalogProductVariantRelation.prototype, "position", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProductVariantRelation.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductVariantRelation.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductVariantRelation.prototype, "updatedAt", 2);
CatalogProductVariantRelation = __decorateClass([
  Entity({ tableName: "catalog_product_variant_relations" }),
  Index({
    name: "catalog_product_variant_relations_parent_idx",
    properties: ["parentVariant", "organizationId", "tenantId"]
  }),
  Index({
    name: "catalog_product_variant_relations_child_idx",
    properties: ["childVariant", "organizationId", "tenantId"]
  }),
  Index({
    name: "catalog_product_variant_relations_child_product_idx",
    properties: ["childProduct", "organizationId", "tenantId"]
  })
], CatalogProductVariantRelation);
OptionalProps;
let CatalogPriceKind = class {
  constructor() {
    this.displayMode = "excluding-tax";
    this.isPromotion = false;
    this.isActive = true;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
    this.prices = new Collection(this);
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogPriceKind.prototype, "id", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid", nullable: true })
], CatalogPriceKind.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogPriceKind.prototype, "tenantId", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogPriceKind.prototype, "code", 2);
__decorateClass([
  Property({ type: "text" })
], CatalogPriceKind.prototype, "title", 2);
__decorateClass([
  Property({ name: "display_mode", type: "text", default: "excluding-tax" })
], CatalogPriceKind.prototype, "displayMode", 2);
__decorateClass([
  Property({ name: "currency_code", type: "text", nullable: true })
], CatalogPriceKind.prototype, "currencyCode", 2);
__decorateClass([
  Property({ name: "is_promotion", type: "boolean", default: false })
], CatalogPriceKind.prototype, "isPromotion", 2);
__decorateClass([
  Property({ name: "is_active", type: "boolean", default: true })
], CatalogPriceKind.prototype, "isActive", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogPriceKind.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogPriceKind.prototype, "updatedAt", 2);
__decorateClass([
  Property({ name: "deleted_at", type: Date, nullable: true })
], CatalogPriceKind.prototype, "deletedAt", 2);
__decorateClass([
  OneToMany(() => CatalogProductPrice, (price) => price.priceKind)
], CatalogPriceKind.prototype, "prices", 2);
CatalogPriceKind = __decorateClass([
  Entity({ tableName: "catalog_price_kinds" }),
  Index({
    name: "catalog_price_kinds_tenant_idx",
    properties: ["tenantId"]
  }),
  Unique({
    name: "catalog_price_kinds_code_tenant_unique",
    properties: ["tenantId", "code"]
  })
], CatalogPriceKind);
OptionalProps;
let CatalogProductPrice = class {
  constructor() {
    this.kind = "regular";
    this.minQuantity = 1;
    this.createdAt = /* @__PURE__ */ new Date();
    this.updatedAt = /* @__PURE__ */ new Date();
  }
};
__decorateClass([
  PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
], CatalogProductPrice.prototype, "id", 2);
__decorateClass([
  ManyToOne(() => CatalogProductVariant, { fieldName: "variant_id", nullable: true })
], CatalogProductPrice.prototype, "variant", 2);
__decorateClass([
  ManyToOne(() => CatalogProduct, { fieldName: "product_id", nullable: true })
], CatalogProductPrice.prototype, "product", 2);
__decorateClass([
  ManyToOne(() => CatalogOffer, { fieldName: "offer_id", nullable: true })
], CatalogProductPrice.prototype, "offer", 2);
__decorateClass([
  ManyToOne(() => CatalogPriceKind, { fieldName: "price_kind_id", deleteRule: "restrict" })
], CatalogProductPrice.prototype, "priceKind", 2);
__decorateClass([
  Property({ name: "organization_id", type: "uuid" })
], CatalogProductPrice.prototype, "organizationId", 2);
__decorateClass([
  Property({ name: "tenant_id", type: "uuid" })
], CatalogProductPrice.prototype, "tenantId", 2);
__decorateClass([
  Property({ name: "currency_code", type: "text" })
], CatalogProductPrice.prototype, "currencyCode", 2);
__decorateClass([
  Property({ name: "kind", type: "text", default: "regular" })
], CatalogProductPrice.prototype, "kind", 2);
__decorateClass([
  Property({ name: "min_quantity", type: "integer", default: 1 })
], CatalogProductPrice.prototype, "minQuantity", 2);
__decorateClass([
  Property({ name: "max_quantity", type: "integer", nullable: true })
], CatalogProductPrice.prototype, "maxQuantity", 2);
__decorateClass([
  Property({ name: "unit_price_net", type: "numeric", precision: 16, scale: 4, nullable: true })
], CatalogProductPrice.prototype, "unitPriceNet", 2);
__decorateClass([
  Property({ name: "unit_price_gross", type: "numeric", precision: 16, scale: 4, nullable: true })
], CatalogProductPrice.prototype, "unitPriceGross", 2);
__decorateClass([
  Property({ name: "tax_rate", type: "numeric", precision: 7, scale: 4, nullable: true })
], CatalogProductPrice.prototype, "taxRate", 2);
__decorateClass([
  Property({ name: "tax_amount", type: "numeric", precision: 16, scale: 4, nullable: true })
], CatalogProductPrice.prototype, "taxAmount", 2);
__decorateClass([
  Property({ name: "channel_id", type: "uuid", nullable: true })
], CatalogProductPrice.prototype, "channelId", 2);
__decorateClass([
  Property({ name: "user_id", type: "uuid", nullable: true })
], CatalogProductPrice.prototype, "userId", 2);
__decorateClass([
  Property({ name: "user_group_id", type: "uuid", nullable: true })
], CatalogProductPrice.prototype, "userGroupId", 2);
__decorateClass([
  Property({ name: "customer_id", type: "uuid", nullable: true })
], CatalogProductPrice.prototype, "customerId", 2);
__decorateClass([
  Property({ name: "customer_group_id", type: "uuid", nullable: true })
], CatalogProductPrice.prototype, "customerGroupId", 2);
__decorateClass([
  Property({ name: "metadata", type: "jsonb", nullable: true })
], CatalogProductPrice.prototype, "metadata", 2);
__decorateClass([
  Property({ name: "starts_at", type: Date, nullable: true })
], CatalogProductPrice.prototype, "startsAt", 2);
__decorateClass([
  Property({ name: "ends_at", type: Date, nullable: true })
], CatalogProductPrice.prototype, "endsAt", 2);
__decorateClass([
  Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
], CatalogProductPrice.prototype, "createdAt", 2);
__decorateClass([
  Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
], CatalogProductPrice.prototype, "updatedAt", 2);
CatalogProductPrice = __decorateClass([
  Entity({ tableName: "catalog_product_variant_prices" }),
  Index({
    name: "catalog_product_variant_prices_variant_scope_idx",
    properties: ["variant", "organizationId", "tenantId"]
  }),
  Index({
    name: "catalog_product_variant_prices_product_scope_idx",
    properties: ["product", "organizationId", "tenantId"]
  })
], CatalogProductPrice);
export {
  CatalogOffer,
  CatalogOptionSchemaTemplate,
  CatalogPriceKind,
  CatalogProduct,
  CatalogProductCategory,
  CatalogProductCategoryAssignment,
  CatalogProductPrice,
  CatalogProductTag,
  CatalogProductTagAssignment,
  CatalogProductUnitConversion,
  CatalogProductVariant,
  CatalogProductVariantRelation
};
//# sourceMappingURL=entities.js.map
