{
  "format": "flex-data-dictionary",
  "formatVersion": 1,
  "exportFormatVersion": 1,
  "conventions": [
    "Each table is exported twice: json/<Table>.json (an array of row objects, column name -> value) and csv/<Table>.csv (UTF-8 with BOM, header row, RFC 4180 quoting). Both carry the columns listed here, in this order.",
    "Ids: every row has a numeric primary key (usually Id) that is unique within its table. Most rows also have a SyncId, a GUID that stays the same on every device and on the server.",
    "References: a column with \"references\" holds the key of a row in another table (Table.Column). The target may be in a table that is not exported (see excludedTables) or belong to a built-in default.",
    "Types: integer, decimal (exact, e.g. money), number (floating point), boolean, string, guid, datetime (ISO-8601), date, time, binary (base64), enum.",
    "Times are ISO-8601. Columns named *Utc and CreatedAt / UpdatedAt are UTC; for other datetime columns see the column's description.",
    "Enums are written by name (e.g. Status = Delivered); \"enumValues\" lists the names. A \"flags\" enum can hold several names separated by \", \".",
    "Soft-deleted rows are included; IsDeleted = true marks them.",
    "nullable = false means every row has a value; maxLength is the longest string the column accepts (absent = unlimited).",
    "Left out on purpose: passwords, sign-in and API credentials, payment-processor tokens, webhook secrets, request logs (excludedTables / excludedColumns). Photos and signatures are files, not rows."
  ],
  "tables": [
    {
      "name": "ActionHistory",
      "entity": "ActionHistoryEntry",
      "description": "An undoable action on an inventory item: what changed (previous and new value), who did it, and whether it was undone.",
      "scopedBy": "e.Item.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActionDescription",
          "type": "string",
          "nullable": false
        },
        {
          "name": "ActionType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "PropertyValueChange",
            "PropertyNameChange",
            "ItemNameChange",
            "ItemDescriptionChange",
            "ParentItemChange",
            "CategoryChange",
            "CalculationChange",
            "PropertyAdd",
            "PropertyDelete",
            "PropertyDataTypeChange"
          ]
        },
        {
          "name": "AdditionalData",
          "type": "string",
          "nullable": false
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsUndone",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "NewValue",
          "type": "string",
          "nullable": false
        },
        {
          "name": "PreviousValue",
          "type": "string",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UndoneAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "UndoneByActionId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "UndoneByActionSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": true
        },
        {
          "name": "UserSyncId",
          "type": "guid",
          "nullable": true
        }
      ]
    },
    {
      "name": "AspNetUsers",
      "entity": "ApplicationUser",
      "description": "A user account (sign-in identity) and the organization it belongs to.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "string",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AccessFailedCount",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "Email",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "EmailConfirmed",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "FirstName",
          "type": "string",
          "nullable": false
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastName",
          "type": "string",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LockoutEnabled",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "LockoutEnd",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "NormalizedEmail",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "NormalizedUserName",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PhoneNumber",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PhoneNumberConfirmed",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TwoFactorEnabled",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "UserName",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "ViewedChangelog",
          "type": "boolean",
          "nullable": false,
          "description": "Whether the user has viewed the changelog for the current version."
        }
      ]
    },
    {
      "name": "Bundles",
      "entity": "Bundle",
      "description": "Represents an instantiated bundle in inventory.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActiveTransferId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "ActiveTransferSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "BundleTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "BundleTemplates.Id"
        },
        {
          "name": "BundleTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplates row that BundleTemplateId points at."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DeletedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DeletedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsInTransit",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "BundleTemplateItems",
      "entity": "BundleTemplateItem",
      "description": "One line of a bundle template: name, quantity and optional item template; lines can nest.",
      "scopedBy": "e.BundleTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BundleTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "BundleTemplates.Id"
        },
        {
          "name": "BundleTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplates row that BundleTemplateId points at."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "HasCalculatedProperties",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "ParentTemplateItemId",
          "type": "integer",
          "nullable": true,
          "references": "BundleTemplateItems.Id"
        },
        {
          "name": "ParentTemplateItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplateItems row that ParentTemplateItemId points at."
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "BundleTemplates",
      "entity": "BundleTemplate",
      "description": "A reusable recipe for a bundle: the item templates and quantities it is built from.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "VendorId",
          "type": "integer",
          "nullable": true,
          "references": "Vendors.Id"
        },
        {
          "name": "VendorPartNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "VendorSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Vendors row that VendorId points at."
        },
        {
          "name": "WholesalePrice",
          "type": "decimal",
          "nullable": true
        }
      ]
    },
    {
      "name": "CalculationDependencies",
      "entity": "CalculationDependency",
      "description": "A link between two items that a calculated property relies on, so a change to the referenced item recalculates the dependent one.",
      "scopedBy": "e.DependentItem.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "guid",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DependentItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id",
          "description": "The item that has the property depending on another item's property ie, the child in a parent-child relationship or the parent in a child-parent relationship"
        },
        {
          "name": "DependentItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that DependentItemId points at."
        },
        {
          "name": "Generation",
          "type": "integer",
          "nullable": false,
          "description": "Generation/depth level in the hierarchy (1-based) 1 = direct parent/child, 2 = grandparent/grandchild, etc."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "PropertyReferenceId",
          "type": "guid",
          "nullable": false,
          "references": "CalculationPropertyReferences.Id"
        },
        {
          "name": "ReferencedItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id",
          "description": "The item that is being depended on ie, the parent in a parent-child relationship or the child in a child-parent relationship"
        },
        {
          "name": "ReferencedItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ReferencedItemId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "CalculationPropertyReferences",
      "entity": "CalculationPropertyReference",
      "description": "A property that a property calculation reads, or writes, as part of its formula.",
      "scopedBy": "(e.PropertyCalculation.Property != null && (e.PropertyCalculation.Property.Item != null && e.PropertyCalculation.Property.Item.OrganizationId == org) || (e.PropertyCalculation.Property.BundleTemplateItem != null && e.PropertyCalculation.Property.BundleTemplateItem.BundleTemplate.OrganizationId == org) || (e.PropertyCalculation.Property.KitItem != null && e.PropertyCalculation.Property.KitItem.Kit.OrganizationId == org)) || (e.PropertyCalculation.TemplateProperty != null && e.PropertyCalculation.TemplateProperty.ItemTemplate.OrganizationId == org)",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "guid",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Direction",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Self",
            "Parent",
            "Child"
          ]
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrderIndex",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "PropertyCalculationId",
          "type": "integer",
          "nullable": false,
          "references": "PropertyCalculations.Id"
        },
        {
          "name": "PropertyCalculationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PropertyCalculations row that PropertyCalculationId points at."
        },
        {
          "name": "ReferencedPropertyId",
          "type": "integer",
          "nullable": true,
          "references": "ItemProperties.Id"
        },
        {
          "name": "ReferencedPropertySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemProperties row that ReferencedPropertyId points at."
        },
        {
          "name": "ReferencedTemplatePropertyId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplateProperties.Id"
        },
        {
          "name": "ReferencedTemplatePropertySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplateProperties row that ReferencedTemplatePropertyId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "CategoryProperties",
      "entity": "CategoryProperty",
      "description": "A property that every item in a category carries (name, data type, default and validation).",
      "scopedBy": "e.Category.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "DataType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Text",
            "Number",
            "Date",
            "Boolean",
            "Dropdown",
            "MultiSelect"
          ]
        },
        {
          "name": "DefaultValue",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsRequired",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Options",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OverridesParentProperty",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "ValidationPattern",
          "type": "string",
          "nullable": true
        }
      ]
    },
    {
      "name": "CustomCharges",
      "entity": "CustomCharge",
      "description": "A custom charge (fee or other line) on a job, with price, discount and cost.",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Cost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false,
          "description": "Discount"
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Charge Name"
        },
        {
          "name": "Price",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SortOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "CustomerAddresses",
      "entity": "CustomerAddress",
      "description": "An address of a customer (a service site, or the mailing address).",
      "scopedBy": "e.Customer.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Address",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "Address2",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Address Line 2"
        },
        {
          "name": "City",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "Country",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": false,
          "references": "Customers.Id"
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsMailingAddress",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "Address Name"
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "PostalCode",
          "type": "string",
          "nullable": true,
          "maxLength": 20,
          "description": "ZIP/Postal Code"
        },
        {
          "name": "State",
          "type": "string",
          "nullable": true,
          "maxLength": 50,
          "description": "State/Province"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Customers",
      "entity": "Customer",
      "description": "A customer of the organization: contact details, billing information and notes.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Address",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "Address2",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Address Line 2"
        },
        {
          "name": "City",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CompanyName",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "Country",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreditLimit",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CurrentBalance",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CustomerStatus",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "None",
            "Preferred",
            "Difficult"
          ]
        },
        {
          "name": "CustomerType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "EndCustomer",
            "Installer",
            "Distributor",
            "Commercial"
          ]
        },
        {
          "name": "DeletedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DeletedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Email",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsTaxExempt",
          "type": "boolean",
          "nullable": true,
          "description": "Tax Exempt"
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MobilePhone",
          "type": "string",
          "nullable": true,
          "maxLength": 20
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Customer Name"
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PaymentTerms",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "DueOnReceipt",
            "Net15",
            "Net30",
            "Net45",
            "Net60",
            "COD",
            "Prepaid"
          ]
        },
        {
          "name": "Phone",
          "type": "string",
          "nullable": true,
          "maxLength": 20
        },
        {
          "name": "PostalCode",
          "type": "string",
          "nullable": true,
          "maxLength": 20,
          "description": "ZIP/Postal Code"
        },
        {
          "name": "PriceTier",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Standard",
            "Silver",
            "Gold",
            "Platinum",
            "Custom"
          ]
        },
        {
          "name": "PrimaryContact",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "State",
          "type": "string",
          "nullable": true,
          "maxLength": 50,
          "description": "State/Province"
        },
        {
          "name": "StoreCreditBalance",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "StoreCreditNotes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaxId",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "WarningNotes",
          "type": "string",
          "nullable": true,
          "maxLength": 1000
        }
      ]
    },
    {
      "name": "CustomRoles",
      "entity": "CustomRole",
      "description": "A custom role: a named set of permissions an organization defines for its users.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CreatedById points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PermissionsJson",
          "type": "string",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "EstimatePreInspectionTemplateItems",
      "entity": "EstimatePreInspectionTemplateItem",
      "description": "An individual checklist item within a section",
      "scopedBy": "e.Section.Template.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CustomStatusOptionsOverride",
          "type": "string",
          "nullable": true,
          "description": "Custom status options when StatusFieldTypeOverride = Custom."
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "HasItemNotes",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemText",
          "type": "string",
          "nullable": false,
          "maxLength": 500
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SectionId",
          "type": "integer",
          "nullable": false,
          "references": "EstimatePreInspectionTemplateSections.Id"
        },
        {
          "name": "SectionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the EstimatePreInspectionTemplateSections row that SectionId points at."
        },
        {
          "name": "StatusFieldTypeOverride",
          "type": "enum",
          "nullable": true,
          "enumValues": [
            "CheckboxOnly",
            "PassFail",
            "PassNeedsAttentionFail",
            "PassNeedsAttentionFailNA",
            "Custom"
          ],
          "description": "Override the template's status field type for this specific item."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "EstimatePreInspectionTemplates",
      "entity": "EstimatePreInspectionTemplate",
      "description": "Template for pre-inspection checklists that can be used during job estimates",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomStatusOptions",
          "type": "string",
          "nullable": true,
          "description": "JSON array of custom status options when StatusFieldType = Custom e.g., [\"Good\", \"Fair\", \"Poor\"]"
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDefault",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Template Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "StatusFieldType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "CheckboxOnly",
            "PassFail",
            "PassNeedsAttentionFail",
            "PassNeedsAttentionFailNA",
            "Custom"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "EstimatePreInspectionTemplateSections",
      "entity": "EstimatePreInspectionTemplateSection",
      "description": "A section/grouping within a pre-inspection template",
      "scopedBy": "e.Template.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "HasSectionNotes",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Section Name"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateId",
          "type": "integer",
          "nullable": false,
          "references": "EstimatePreInspectionTemplates.Id"
        },
        {
          "name": "TemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the EstimatePreInspectionTemplates row that TemplateId points at."
        }
      ]
    },
    {
      "name": "GlobalVariables",
      "entity": "GlobalVariable",
      "description": "Represents a global variable that can be used in calculations across all items and templates.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Value",
          "type": "decimal",
          "nullable": false,
          "description": "The numeric value of the global variable."
        }
      ]
    },
    {
      "name": "HeaderSynonyms",
      "entity": "HeaderSynonym",
      "description": "Maps CSV header synonyms to standard property mappings.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BarcodeType",
          "type": "string",
          "nullable": true,
          "maxLength": 50,
          "description": "For Barcode mappings, the barcode type (SKU, UPC, etc.)."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false,
          "description": "Whether this synonym is active."
        },
        {
          "name": "IsBuiltIn",
          "type": "boolean",
          "nullable": false,
          "description": "Whether this is a built-in (system) synonym or user-created."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MappingType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Property",
            "Category",
            "Barcode",
            "Skip"
          ],
          "description": "The target mapping type."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": true,
          "references": "Organizations.Id",
          "description": "Organization ID for org-specific synonyms."
        },
        {
          "name": "Priority",
          "type": "integer",
          "nullable": false,
          "description": "Priority for matching (lower = higher priority)."
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": true,
          "maxLength": 100,
          "description": "For Property mappings, the property name to map to."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Synonym",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "The CSV header value (synonym) that should trigger this mapping."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ImportJobs",
      "entity": "ImportJob",
      "description": "One CSV import run: the file, its vendor and template, status and row counts.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BarcodeColumnsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CategoryColumnsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CategoryMappingJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ColumnMappingJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CompletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CsvContent",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DeletedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DualPriceConfigJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DuplicateResolutionJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ErrorLog",
          "type": "string",
          "nullable": true,
          "maxLength": 2000
        },
        {
          "name": "FailedRows",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "FileName",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "FileSize",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ImportTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ImportTemplates.Id"
        },
        {
          "name": "ImportTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ImportTemplates row that ImportTemplateId points at."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PendingTemplateName",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "PrimaryBarcodeColumn",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "ProcessedRows",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SplitColumnsConfigJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SplitColumnsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "StartedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "Processing",
            "Completed",
            "Failed",
            "PartiallyCompleted",
            "Cancelled"
          ]
        },
        {
          "name": "SuccessfulRows",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateAssignmentJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "TemplateColumnsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "TotalRows",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "VendorId",
          "type": "integer",
          "nullable": true,
          "references": "Vendors.Id"
        },
        {
          "name": "VendorSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Vendors row that VendorId points at."
        }
      ]
    },
    {
      "name": "ImportTemplates",
      "entity": "ImportTemplate",
      "description": "A saved CSV column mapping for importing a vendor's price list or catalog.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ColumnMappingJson",
          "type": "string",
          "nullable": false
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "DefaultCategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "GlobalTransformationsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemOverridesJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MatchingField",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "NameTransformationsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdateExistingItems",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "VendorId",
          "type": "integer",
          "nullable": false,
          "references": "Vendors.Id"
        }
      ]
    },
    {
      "name": "InvoiceLineItems",
      "entity": "InvoiceLineItem",
      "description": "One line of an invoice: description, type, quantity, unit price and discount.",
      "scopedBy": "e.Invoice.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ConfigurationSummary",
          "type": "string",
          "nullable": true,
          "maxLength": 1000,
          "description": "Configuration"
        },
        {
          "name": "CustomChargeSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 500
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false,
          "description": "Discount %"
        },
        {
          "name": "InvoiceId",
          "type": "integer",
          "nullable": false,
          "references": "Invoices.Id"
        },
        {
          "name": "InvoiceSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Invoices row that InvoiceId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Material",
            "Labor",
            "Service",
            "Other"
          ]
        },
        {
          "name": "JobItemId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "JobItemSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "LaborItemSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 1000,
          "description": "Line Note"
        },
        {
          "name": "OriginalUnitPrice",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "Quantity",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SalesOrderItemId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "SalesOrderItemSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "SortOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitOfMeasure",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "InvoiceNotes",
      "entity": "InvoiceNote",
      "description": "A note on an invoice.",
      "scopedBy": "e.Invoice.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "InvoiceId",
          "type": "integer",
          "nullable": false,
          "references": "Invoices.Id"
        },
        {
          "name": "InvoiceSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Invoices row that InvoiceId points at."
        },
        {
          "name": "IsInternal",
          "type": "boolean",
          "nullable": false,
          "description": "Hide from Customer"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "NoteText",
          "type": "string",
          "nullable": false,
          "description": "Note"
        },
        {
          "name": "NoteType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "General",
            "Payment",
            "Internal",
            "CustomerCommunication",
            "BillingAdjustment"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "InvoicePayments",
      "entity": "InvoicePayment",
      "description": "Represents a payment record for an invoice.",
      "scopedBy": "e.Invoice.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Amount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "FeeStatus",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "NotApplicable",
            "Pending",
            "Known",
            "Revised"
          ],
          "description": "Whether InvoicePayment.ProcessorFee can be trusted yet."
        },
        {
          "name": "InvoiceId",
          "type": "integer",
          "nullable": false,
          "references": "Invoices.Id"
        },
        {
          "name": "InvoiceSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Invoices row that InvoiceId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "PaymentDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "PaymentMethod",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "Processor",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "None",
            "Square",
            "Stripe"
          ],
          "description": "Which processor took this payment, or PaymentProcessor.None for cash, cheque and anything else keyed in by hand."
        },
        {
          "name": "ProcessorFee",
          "type": "decimal",
          "nullable": true,
          "description": "What the processor kept, in the same currency as InvoicePayment.Amount."
        },
        {
          "name": "ProcessorTransactionId",
          "type": "string",
          "nullable": true,
          "maxLength": 100,
          "description": "The processor's own id for the payment (Stripe PaymentIntent, Square Payment)."
        },
        {
          "name": "ReferenceNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Invoices",
      "entity": "Invoice",
      "description": "An invoice to a customer: number, dates, status, tax, discounts and amount paid.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AmountPaid",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "ConsolidatedIntoInvoiceId",
          "type": "integer",
          "nullable": true,
          "references": "Invoices.Id",
          "description": "If this invoice was consolidated into another invoice, this references the combined invoice"
        },
        {
          "name": "ConsolidatedIntoInvoiceSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Invoices row that ConsolidatedIntoInvoiceId points at."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomerAddressId",
          "type": "integer",
          "nullable": true,
          "references": "CustomerAddresses.Id",
          "description": "Service Address"
        },
        {
          "name": "CustomerAddressSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the CustomerAddresses row that CustomerAddressId points at."
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": true,
          "references": "Customers.Id",
          "description": "Customer"
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 2000
        },
        {
          "name": "DueDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "EmailedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Invoice Emailed At"
        },
        {
          "name": "EmailedTo",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Invoice Emailed To"
        },
        {
          "name": "InvoiceDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "InvoiceNumber",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "InvoiceSequenceNumber",
          "type": "integer",
          "nullable": true,
          "description": "Sequence number for multiple invoices on same sales order or job (1, 2, 3, etc.) For supplemental invoices: 1 = original, 2 = first supplement, 3 = second supplement NULL for standalone invoices only"
        },
        {
          "name": "IsConsolidatedInvoice",
          "type": "boolean",
          "nullable": false,
          "description": "Quick flag to identify consolidated invoices (avoids parsing SourceInvoiceIds)"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsStandalone",
          "type": "boolean",
          "nullable": false,
          "description": "Is Standalone Invoice"
        },
        {
          "name": "JobDiscountFactor",
          "type": "decimal",
          "nullable": false,
          "description": "Job-level discount factor FROZEN at finalize time. 1 = none/legacy."
        },
        {
          "name": "JobDiscountNote",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "JobDiscountPercent",
          "type": "decimal",
          "nullable": true,
          "description": "Frozen percent for the discount row label (\"Discount (10%)\"); null for $-type or none."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": true,
          "references": "Jobs.Id",
          "description": "Job"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PaidDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "PaymentInstructions",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PaymentLinkCreatedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Payment Link Created"
        },
        {
          "name": "PaymentLinkId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "PaymentLinkUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": true,
          "references": "SalesOrders.Id",
          "description": "Sales Order"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SentDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "SourceInvoiceIds",
          "type": "string",
          "nullable": true,
          "maxLength": 4000,
          "description": "For consolidated invoices: JSON array of source invoice IDs that were combined Example: \"[123, 456, 789]\""
        },
        {
          "name": "SourceInvoiceSyncIds",
          "type": "string",
          "nullable": true,
          "maxLength": 4000
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Draft",
            "Sent",
            "Viewed",
            "PartiallyPaid",
            "Paid",
            "Overdue",
            "Cancelled",
            "Outstanding",
            "Consolidated"
          ]
        },
        {
          "name": "StoreCreditApplied",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Subtotal",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaxAmountOverride",
          "type": "decimal",
          "nullable": true,
          "description": "Pre-computed tax amount for consolidated invoices with mixed tax rates."
        },
        {
          "name": "TaxRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "TaxableSubtotal",
          "type": "decimal",
          "nullable": true,
          "description": "Taxable portion of the subtotal."
        },
        {
          "name": "Terms",
          "type": "string",
          "nullable": true,
          "maxLength": 500,
          "description": "Payment Terms"
        }
      ]
    },
    {
      "name": "ItemBarcodes",
      "entity": "ItemBarcode",
      "description": "Represents a barcode associated with a specific inventory item.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BarcodeValue",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsPrimary",
          "type": "boolean",
          "nullable": false,
          "description": "Indicates if this is the primary/default barcode for the item"
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Type",
          "type": "string",
          "nullable": false,
          "maxLength": 50,
          "description": "Flexible barcode type - user can define any type."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemCatalog",
      "entity": "ItemCatalog",
      "description": "Represents a catalog entry for standard inventory items.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Barcode",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "Item Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemCatalogProperty",
      "entity": "ItemCatalogProperty",
      "description": "Represents a property for an item catalog entry.",
      "scopedBy": "e.ItemCatalog.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ItemCatalogId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCatalog.Id"
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "PropertyValue",
          "type": "string",
          "nullable": false
        }
      ]
    },
    {
      "name": "ItemCategories",
      "entity": "ItemCategory",
      "description": "A category that items and templates are classified by (categories can be nested).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsSystemCategory",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ParentCategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "ParentCategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that ParentCategoryId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderId",
          "type": "integer",
          "nullable": true,
          "references": "TemplateBuilders.Id"
        },
        {
          "name": "TemplateBuilderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TemplateBuilders row that TemplateBuilderId points at."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemCategoryAssignments",
      "entity": "ItemCategoryAssignment",
      "description": "Junction table for many-to-many relationship between Item and ItemCategory.",
      "scopedBy": "e.Item.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ItemChangeLogs",
      "entity": "ItemChangeLog",
      "description": "A history entry for an inventory item: a move, property change or other change.",
      "scopedBy": "e.Item != null && e.Item.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ChangeType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Created",
            "Updated",
            "Deleted",
            "LocationChanged",
            "ParentChanged",
            "PropertyChanged"
          ]
        },
        {
          "name": "ChangedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": false,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "NewLocationId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "NewLocationSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "NewParentId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "NewParentSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "NewValues",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OldLocationId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "OldLocationSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "OldParentId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "OldParentSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "OldValues",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "UserSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that UserId points at."
        }
      ]
    },
    {
      "name": "ItemProperties",
      "entity": "ItemProperty",
      "description": "A property value on an item, bundle line or kit line (name, value and data type).",
      "scopedBy": "(e.Item != null && e.Item.OrganizationId == org) || (e.BundleTemplateItem != null && e.BundleTemplateItem.BundleTemplate.OrganizationId == org) || (e.KitItem != null && e.KitItem.Kit.OrganizationId == org)",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BundleTemplateItemId",
          "type": "integer",
          "nullable": true,
          "references": "BundleTemplateItems.Id"
        },
        {
          "name": "BundleTemplateItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplateItems row that BundleTemplateItemId points at."
        },
        {
          "name": "DataType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Text",
            "Number",
            "Date",
            "Boolean",
            "Dropdown",
            "MultiSelect"
          ]
        },
        {
          "name": "IsLocalProperty",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsOverwritten",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": true,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "KitItemId",
          "type": "integer",
          "nullable": true,
          "references": "KitItems.Id"
        },
        {
          "name": "KitItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the KitItems row that KitItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Options",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false
        },
        {
          "name": "PropertyValue",
          "type": "string",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Items",
      "entity": "Item",
      "description": "An inventory item: one physical unit or stock line, where it is, and what it was made from.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActiveTransferId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "ActiveTransferSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "AutoGeneratedName",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "BundleId",
          "type": "integer",
          "nullable": true,
          "references": "Bundles.Id"
        },
        {
          "name": "BundleSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Bundles row that BundleId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DirectCategoryIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DirectCategorySyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "HasCalculatedProperties",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsInTransit",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsNameOverwritten",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastMovedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "LastMovedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "MoveHistory",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ParentItemId",
          "type": "integer",
          "nullable": true,
          "references": "Items.Id"
        },
        {
          "name": "ParentItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ParentItemId points at."
        },
        {
          "name": "ReceivedItemId",
          "type": "integer",
          "nullable": true,
          "references": "ReceivedItems.Id"
        },
        {
          "name": "SourcePurchaseOrderId",
          "type": "integer",
          "nullable": true,
          "references": "PurchaseOrders.Id"
        },
        {
          "name": "SourcePurchaseOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrders row that SourcePurchaseOrderId points at."
        },
        {
          "name": "SourceShipmentId",
          "type": "integer",
          "nullable": true,
          "references": "PurchaseOrderShipments.Id"
        },
        {
          "name": "SourceShipmentSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrderShipments row that SourceShipmentId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "TemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that TemplateId points at."
        },
        {
          "name": "UnitsConsumed",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemStockThresholds",
      "entity": "ItemStockThreshold",
      "description": "A minimum-stock rule for an item template, optionally per location, used for low-stock alerts.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "MinimumStock",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ReorderQuantity",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        }
      ]
    },
    {
      "name": "ItemTemplateBarcodes",
      "entity": "ItemTemplateBarcode",
      "description": "Represents a barcode associated with an item template.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BarcodeValue",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsPrimary",
          "type": "boolean",
          "nullable": false,
          "description": "Indicates if this is the primary/default barcode for the template"
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Type",
          "type": "string",
          "nullable": false,
          "maxLength": 50,
          "description": "Flexible barcode type - user can define any type."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemTemplateCategoryAssignments",
      "entity": "ItemTemplateCategoryAssignment",
      "description": "Junction table for many-to-many relationship between ItemTemplate and ItemCategory.",
      "scopedBy": "e.ItemTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ItemTemplateModifierGroups",
      "entity": "ItemTemplateModifierGroup",
      "description": "One option step (\"Add-on\" group) shown when adding a configurable item to a job: e.g. a garage door's \"Color\", \"Panel\", \"Windows\", \"Premium Hardware\".",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MaxTotalQuantity",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SelectionMode",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "ChooseOne",
            "ChooseOneOptional",
            "ChooseManyWithQuantity"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ItemTemplateModifierOptions",
      "entity": "ItemTemplateModifierOption",
      "description": "One choice within an ItemTemplateModifierGroup, e.g. Color -> \"Weathered Grey\" (+25% of base) or Windows -> \"Clear Window Short, Pan\" (+$28.25 per lite).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDefault",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifierGroupId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplateModifierGroups.Id"
        },
        {
          "name": "ModifierGroupSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplateModifierGroups row that ModifierGroupId points at."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 150
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PriceType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Fixed",
            "PercentOfBase"
          ]
        },
        {
          "name": "PriceValue",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ItemTemplatePriceTiers",
      "entity": "ItemTemplatePriceTier",
      "description": "One quantity price break for an item template (Bulk Pricing).",
      "scopedBy": "e.ItemTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MinQuantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "ItemTemplateProperties",
      "entity": "ItemTemplateProperty",
      "description": "Represents a property for an item template.",
      "scopedBy": "e.ItemTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DataType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Text",
            "Number",
            "Date",
            "Boolean",
            "Dropdown",
            "MultiSelect"
          ]
        },
        {
          "name": "IsLocalProperty",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsOverwritten",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Options",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "PropertyValue",
          "type": "string",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ItemTemplates",
      "entity": "ItemTemplate",
      "description": "Represents a template for creating inventory items",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AutoGeneratedName",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DirectCategoryIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DirectCategorySyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ImportJobId",
          "type": "integer",
          "nullable": true,
          "references": "ImportJobs.Id"
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsDraft",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsMiscItem",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsNameOverwritten",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsParentTemplate",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ParentTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ParentTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ParentTemplateId points at."
        },
        {
          "name": "SellByUnits",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SubUnitParentTemplateSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderId",
          "type": "integer",
          "nullable": true,
          "references": "TemplateBuilders.Id"
        },
        {
          "name": "TemplateBuilderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TemplateBuilders row that TemplateBuilderId points at."
        },
        {
          "name": "UnitName",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "UnitsPerParent",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "ItemTemplateSimilarities",
      "entity": "ItemTemplateSimilarity",
      "description": "A link between two similar item templates (type of similarity, score and notes).",
      "scopedBy": "e.ItemTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 450
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "SimilarItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "SimilarItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that SimilarItemTemplateId points at."
        },
        {
          "name": "SimilarityScore",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SimilarityType",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 450
        },
        {
          "name": "UpdatedDate",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "JobAssignments",
      "entity": "JobAssignment",
      "description": "A user assigned to work a scheduled job.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ScheduleGroupId",
          "type": "integer",
          "nullable": true,
          "references": "ScheduleGroups.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": false,
          "references": "AspNetUsers.Id"
        }
      ]
    },
    {
      "name": "JobEstimateOptionCharges",
      "entity": "JobEstimateOptionCharge",
      "description": "Custom charge within an estimate option",
      "scopedBy": "e.EstimateOption.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Cost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "EstimateOptionId",
          "type": "integer",
          "nullable": false,
          "references": "JobEstimateOptions.Id"
        },
        {
          "name": "EstimateOptionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimateOptions row that EstimateOptionId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Charge Name"
        },
        {
          "name": "Price",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "JobEstimateOptionLabors",
      "entity": "JobEstimateOptionLabor",
      "description": "Labor item within an estimate option",
      "scopedBy": "e.EstimateOption.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CustomerRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "EmployeeCostRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "EstimateOptionId",
          "type": "integer",
          "nullable": false,
          "references": "JobEstimateOptions.Id"
        },
        {
          "name": "EstimateOptionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimateOptions row that EstimateOptionId points at."
        },
        {
          "name": "EstimatedHours",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LaborRateId",
          "type": "integer",
          "nullable": true,
          "references": "LaborRates.Id",
          "description": "Labor Rate"
        },
        {
          "name": "LaborRateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LaborRates row that LaborRateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "OverheadFactor",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "JobEstimateOptionMaterials",
      "entity": "JobEstimateOptionMaterial",
      "description": "Material item within an estimate option",
      "scopedBy": "e.EstimateOption.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false,
          "description": "Discount %"
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "EstimateOptionId",
          "type": "integer",
          "nullable": false,
          "references": "JobEstimateOptions.Id"
        },
        {
          "name": "EstimateOptionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimateOptions row that EstimateOptionId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id",
          "description": "Item Template"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "JobEstimateOptions",
      "entity": "JobEstimateOption",
      "description": "Represents an option in a job estimate (e.g., \"Basic Package\", \"Premium Package\").",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsRecommended",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsSelected",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "Option Name"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "JobEstimatePreInspectionItems",
      "entity": "JobEstimatePreInspectionItem",
      "description": "A completed item response in a job's pre-inspection checklist",
      "scopedBy": "e.JobInspection.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CompletedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id",
          "description": "Completed By"
        },
        {
          "name": "CompletedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CompletedById points at."
        },
        {
          "name": "CompletedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemText",
          "type": "string",
          "nullable": false,
          "maxLength": 500
        },
        {
          "name": "JobInspectionId",
          "type": "integer",
          "nullable": false,
          "references": "JobEstimatePreInspections.Id"
        },
        {
          "name": "JobInspectionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimatePreInspections row that JobInspectionId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SectionName",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "SectionNotes",
          "type": "string",
          "nullable": true,
          "description": "Section-level notes (stored on first item of section for simplicity)"
        },
        {
          "name": "StatusValue",
          "type": "string",
          "nullable": true,
          "maxLength": 100,
          "description": "The selected status value - \"Pass\", \"Fail\", \"true\", \"false\", etc."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateItemId",
          "type": "integer",
          "nullable": true,
          "references": "EstimatePreInspectionTemplateItems.Id",
          "description": "Reference to the template item (null if ad-hoc item added during inspection)"
        },
        {
          "name": "TemplateItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the EstimatePreInspectionTemplateItems row that TemplateItemId points at."
        },
        {
          "name": "TemplateSectionId",
          "type": "integer",
          "nullable": true,
          "references": "EstimatePreInspectionTemplateSections.Id",
          "description": "Reference to the section (for ordering and grouping)"
        },
        {
          "name": "TemplateSectionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the EstimatePreInspectionTemplateSections row that TemplateSectionId points at."
        }
      ]
    },
    {
      "name": "JobEstimatePreInspections",
      "entity": "JobEstimatePreInspection",
      "description": "A completed pre-inspection checklist for a specific job",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CompletedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomTitle",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "User can override the title for this specific job's checklist"
        },
        {
          "name": "IncludeInPdf",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "InspectedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id",
          "description": "Inspected By"
        },
        {
          "name": "InspectedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that InspectedById points at."
        },
        {
          "name": "InspectedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LockedDate",
          "type": "datetime",
          "nullable": true,
          "description": "When the job started - checklist becomes read-only after this"
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "NotStarted",
            "InProgress",
            "Completed"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateId",
          "type": "integer",
          "nullable": false,
          "references": "EstimatePreInspectionTemplates.Id"
        },
        {
          "name": "TemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the EstimatePreInspectionTemplates row that TemplateId points at."
        }
      ]
    },
    {
      "name": "JobEstimatePreInspectionSnapshots",
      "entity": "JobEstimatePreInspectionSnapshot",
      "description": "Snapshot of a pre-inspection checklist state for audit purposes",
      "scopedBy": "e.JobInspection.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobInspectionId",
          "type": "integer",
          "nullable": false,
          "references": "JobEstimatePreInspections.Id"
        },
        {
          "name": "JobInspectionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimatePreInspections row that JobInspectionId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "SnapshotData",
          "type": "string",
          "nullable": false,
          "description": "JSON serialization of the full checklist state at time of snapshot"
        },
        {
          "name": "SnapshotDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "SnapshotType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "SentToCustomer",
            "PreEdit",
            "JobStarted",
            "ManualSave"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "JobItemModifierSelections",
      "entity": "JobItemModifierSelection",
      "description": "A configured add-on choice on a job line — SNAPSHOT semantics, like JobItem.UnitPrice.",
      "scopedBy": "e.JobItem.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "GroupName",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobItemId",
          "type": "integer",
          "nullable": false,
          "references": "JobItems.Id"
        },
        {
          "name": "JobItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobItems row that JobItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifierOptionId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplateModifierOptions.Id"
        },
        {
          "name": "ModifierOptionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplateModifierOptions row that ModifierOptionId points at."
        },
        {
          "name": "OptionName",
          "type": "string",
          "nullable": false,
          "maxLength": 150
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitUpcharge",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "JobItems",
      "entity": "JobItem",
      "description": "A material line on a job: the item or template, quantity, price, discount and cost.",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualItemId",
          "type": "integer",
          "nullable": true,
          "references": "Items.Id",
          "description": "Actual Item"
        },
        {
          "name": "ActualItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ActualItemId points at."
        },
        {
          "name": "DeliveredQuantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false,
          "description": "Discount"
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsPriceOverridden",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id",
          "description": "Item Template"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "PreferredItemIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredItemSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredSourceLocationIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredSourceLocationSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ReservedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Planned",
            "Reserved",
            "Used",
            "Returned",
            "Cancelled"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UsedDate",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "Jobs",
      "entity": "Job",
      "description": "A job (work order): customer, address, status, schedule, estimate and totals.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualLaborCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "ActualMaterialCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CompletedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomChargesTotal",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CustomerAddressId",
          "type": "integer",
          "nullable": true,
          "references": "CustomerAddresses.Id",
          "description": "Service Address"
        },
        {
          "name": "CustomerAddressSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the CustomerAddresses row that CustomerAddressId points at."
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": false,
          "references": "Customers.Id",
          "description": "Customer"
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": true,
          "description": "Job Discount ($)"
        },
        {
          "name": "DiscountNote",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": true,
          "description": "Job Discount (%)"
        },
        {
          "name": "DownPaymentAmount",
          "type": "decimal",
          "nullable": true,
          "description": "Down Payment"
        },
        {
          "name": "DownPaymentAppliedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "Set when the down payment transferred to an invoice (exactly once)."
        },
        {
          "name": "DownPaymentDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DownPaymentMethod",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "DownPaymentNote",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "EmailedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Invoice Emailed At"
        },
        {
          "name": "EmailedTo",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Invoice Emailed To"
        },
        {
          "name": "EstimatedLaborCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "EstimatedMaterialCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "HasMultipleOptions",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobNumber",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "JobSiteLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id",
          "description": "Job Site Location"
        },
        {
          "name": "JobSiteLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that JobSiteLocationId points at."
        },
        {
          "name": "JobStatusDefinitionId",
          "type": "integer",
          "nullable": true,
          "references": "JobStatusDefinitions.Id",
          "description": "Custom Status"
        },
        {
          "name": "JobStatusDefinitionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobStatusDefinitions row that JobStatusDefinitionId points at."
        },
        {
          "name": "JobType",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "LaborPrice",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MaterialPrice",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PaymentLinkCreatedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Payment Link Created"
        },
        {
          "name": "PaymentLinkId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "PaymentLinkUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "PaymentStatus",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "ScheduledDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ScheduledDurationMinutes",
          "type": "integer",
          "nullable": true,
          "description": "Planned length of the scheduled visit in minutes."
        },
        {
          "name": "SelectedOptionId",
          "type": "integer",
          "nullable": true,
          "references": "JobEstimateOptions.Id",
          "description": "Selected Option"
        },
        {
          "name": "SelectedOptionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobEstimateOptions row that SelectedOptionId points at."
        },
        {
          "name": "StartDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Draft",
            "Estimated",
            "Scheduled",
            "InProgress",
            "Completed",
            "Invoiced",
            "Paid",
            "Cancelled",
            "Outstanding",
            "InspectionInProgress",
            "AwaitingOptionSelection"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaxCustomCharges",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "TaxLabor",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "TaxMaterials",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "TaxRate",
          "type": "decimal",
          "nullable": false,
          "description": "Tax Rate (%)"
        }
      ]
    },
    {
      "name": "JobStatusDefinitions",
      "entity": "JobStatusDefinition",
      "description": "A job status the organization defines (name, color, order and allowed transitions).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AllowedTransitionSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "AllowedTransitionsJson",
          "type": "string",
          "nullable": true,
          "description": "Can Transition To"
        },
        {
          "name": "AllowsInvoicing",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ColorHex",
          "type": "string",
          "nullable": true,
          "maxLength": 7,
          "description": "Color"
        },
        {
          "name": "CountsAsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "CountsAsCompleted",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsSystemStatus",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 50,
          "description": "Status Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "RequiresCompletionFields",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "RequiresScheduleDate",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "SystemStatusType",
          "type": "enum",
          "nullable": true,
          "enumValues": [
            "Draft",
            "Estimated",
            "Scheduled",
            "InProgress",
            "Completed",
            "Invoiced",
            "Paid",
            "Cancelled",
            "Outstanding",
            "InspectionInProgress",
            "AwaitingOptionSelection"
          ]
        }
      ]
    },
    {
      "name": "JobUpdates",
      "entity": "JobUpdate",
      "description": "An entry on a job's timeline: a note, status change, photo, signature or other update.",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AttachmentName",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "AttachmentUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CreatedByName",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 2000
        },
        {
          "name": "IsInternal",
          "type": "boolean",
          "nullable": false,
          "description": "Internal Note"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "NewStatus",
          "type": "enum",
          "nullable": true,
          "enumValues": [
            "Draft",
            "Estimated",
            "Scheduled",
            "InProgress",
            "Completed",
            "Invoiced",
            "Paid",
            "Cancelled",
            "Outstanding",
            "InspectionInProgress",
            "AwaitingOptionSelection"
          ]
        },
        {
          "name": "OldStatus",
          "type": "enum",
          "nullable": true,
          "enumValues": [
            "Draft",
            "Estimated",
            "Scheduled",
            "InProgress",
            "Completed",
            "Invoiced",
            "Paid",
            "Cancelled",
            "Outstanding",
            "InspectionInProgress",
            "AwaitingOptionSelection"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdateType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "GeneralNote",
            "ProgressUpdate",
            "Issue",
            "CustomerRequest",
            "ChangeOrder",
            "Delay",
            "MaterialNote",
            "CompletionNote",
            "StatusChange",
            "ScheduleChange",
            "Payment",
            "Return",
            "Photo",
            "Signature",
            "TextMessage"
          ]
        }
      ]
    },
    {
      "name": "KitItems",
      "entity": "KitItem",
      "description": "One line of a kit (a planned set of items for a transfer); lines can nest.",
      "scopedBy": "e.Kit.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "HasCalculatedProperties",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "KitId",
          "type": "integer",
          "nullable": false,
          "references": "Kits.Id"
        },
        {
          "name": "KitSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Kits row that KitId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "ParentKitItemId",
          "type": "integer",
          "nullable": true,
          "references": "KitItems.Id"
        },
        {
          "name": "ParentKitItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the KitItems row that ParentKitItemId points at."
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Kits",
      "entity": "Kit",
      "description": "A kit: a named set of items planned to move together in transfers.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "description": "Kit Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "LaborItems",
      "entity": "LaborItem",
      "description": "A labor line on a job: task, labor rate, hours, customer rate, discount and employee cost.",
      "scopedBy": "e.Job.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualHours",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CustomerPriceOverride",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "CustomerRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false,
          "description": "Discount"
        },
        {
          "name": "EmployeeCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "EstimatedHours",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": false,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LaborRateId",
          "type": "integer",
          "nullable": true,
          "references": "LaborRates.Id",
          "description": "Labor Rate"
        },
        {
          "name": "LaborRateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LaborRates row that LaborRateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OverheadFactor",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Planned",
            "Scheduled",
            "InProgress",
            "Completed",
            "Cancelled"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaskTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "TaskTemplates.Id",
          "description": "Task Template"
        },
        {
          "name": "TaskTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TaskTemplates row that TaskTemplateId points at."
        },
        {
          "name": "TechnicianId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id",
          "description": "Technician"
        },
        {
          "name": "WorkDate",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "LaborRates",
      "entity": "LaborRate",
      "description": "A labor rate: the hourly rate charged for a kind of work, and its employee cost and overhead.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "EmployeeCost",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "HourlyRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "Rate Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "OverheadFactor",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "RateType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Standard",
            "Emergency",
            "Weekend",
            "AfterHours",
            "SkillLevel",
            "Custom",
            "Flat"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Locations",
      "entity": "Location",
      "description": "A place that holds inventory (warehouse, truck, bin, job site); locations can be nested.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Address",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsSystemLocation",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationTypeId",
          "type": "integer",
          "nullable": false,
          "references": "LocationTypes.Id"
        },
        {
          "name": "LocationTypeSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LocationTypes row that LocationTypeId points at."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ParentLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "ParentLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that ParentLocationId points at."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Active",
            "Inactive",
            "Maintenance",
            "Temporary"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "LocationTransferItems",
      "entity": "LocationTransferItem",
      "description": "One item moved in a location transfer.",
      "scopedBy": "e.Transfer.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DestinationLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "DestinationLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that DestinationLocationId points at."
        },
        {
          "name": "DestinationWaypointId",
          "type": "integer",
          "nullable": true,
          "references": "TransferWaypoints.Id"
        },
        {
          "name": "DestinationWaypointSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TransferWaypoints row that DestinationWaypointId points at."
        },
        {
          "name": "FailedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "FailedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "FailedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that FailedById points at."
        },
        {
          "name": "FailureReason",
          "type": "string",
          "nullable": true
        },
        {
          "name": "GroupedItemIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "GroupedItemSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": true,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "JobItemId",
          "type": "integer",
          "nullable": true,
          "references": "JobItems.Id"
        },
        {
          "name": "JobItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the JobItems row that JobItemId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationTransferLogId",
          "type": "integer",
          "nullable": false,
          "references": "LocationTransferLogs.Id"
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "QuantityDelivered",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "QuantityPicked",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "QuantityReturned",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SalesOrderItemId",
          "type": "integer",
          "nullable": true,
          "references": "SalesOrderItems.Id"
        },
        {
          "name": "SalesOrderItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrderItems row that SalesOrderItemId points at."
        },
        {
          "name": "Scanned",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ScannedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ScannedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "ScannedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that ScannedById points at."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "InTransit",
            "Delivered",
            "Failed",
            "Returned"
          ]
        },
        {
          "name": "SubUnitDrawsJson",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SubUnitShortfallUnits",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferSyncId",
          "type": "guid",
          "nullable": true
        }
      ]
    },
    {
      "name": "LocationTransferLogs",
      "entity": "LocationTransferLog",
      "description": "A transfer of items between locations: source, destination, status and dates.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CompletedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CompletedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CompletedById points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CurrentWaypointId",
          "type": "integer",
          "nullable": true,
          "references": "TransferWaypoints.Id",
          "description": "ID of the current waypoint in the journey, if using waypoints"
        },
        {
          "name": "CurrentWaypointSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TransferWaypoints row that CurrentWaypointId points at."
        },
        {
          "name": "DestinationLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "DestinationLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that DestinationLocationId points at."
        },
        {
          "name": "HasWaypoints",
          "type": "boolean",
          "nullable": false,
          "description": "Waypoint support for intermediate locations in the transfer journey"
        },
        {
          "name": "InitiatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "InitiatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that InitiatedById points at."
        },
        {
          "name": "IsJobTransfer",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsSalesOrderTransfer",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": true,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "RequiresApproval",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": true,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SourceLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "SourceLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that SourceLocationId points at."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Draft",
            "Pending",
            "InTransit",
            "AtWaypoint",
            "InTransitToWaypoint",
            "InTransitToDestination",
            "Completed",
            "Cancelled",
            "Failed"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "TransportVehicleId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id",
          "description": "Optional transport vehicle used for this transfer"
        },
        {
          "name": "TransportVehicleSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that TransportVehicleId points at."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "LocationTypes",
      "entity": "LocationType",
      "description": "A kind of location (e.g. warehouse, truck, shelf) the organization defines.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ConsumesInventory",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsJobSite",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsSystemType",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsTransportVehicle",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "NotificationDismissals",
      "entity": "NotificationDismissal",
      "description": "A record that a user dismissed a notification.",
      "scopedBy": "e.Notification.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "DismissedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "NotificationId",
          "type": "integer",
          "nullable": false,
          "references": "Notifications.Id"
        },
        {
          "name": "NotificationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Notifications row that NotificationId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "UserSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that UserId points at."
        }
      ]
    },
    {
      "name": "Notifications",
      "entity": "Notification",
      "description": "An in-app notification for the organization or one user.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DismissedByUserId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "DismissedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ExpiresDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LinkUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "Message",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "Priority",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "RelatedInvoiceId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "RelatedInvoiceSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "RelatedJobId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "RelatedJobSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "RelatedPurchaseOrderId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "RelatedPurchaseOrderSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "RelatedTransferId",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "RelatedTransferSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Title",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "Type",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "General",
            "TransferInProgress",
            "JobInProgress",
            "PaymentDue",
            "PaymentOverdue",
            "LowStock",
            "TransferApprovalNeeded",
            "JobScheduled",
            "SystemAlert",
            "ShipmentDeliveryToday"
          ]
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "UserSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that UserId points at."
        }
      ]
    },
    {
      "name": "OrganizationJobTypes",
      "entity": "OrganizationJobType",
      "description": "A job type the organization defines (e.g. install, repair, maintenance).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100,
          "description": "Job Type Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "OrganizationModules",
      "entity": "OrganizationModule",
      "description": "Per-organization activation record for an optional module (see Flex.Modules.ModuleCatalog).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActivatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "ActivatedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        },
        {
          "name": "BillingProvider",
          "type": "string",
          "nullable": false,
          "maxLength": 50,
          "description": "Provider key: \"sandbox\", \"square\", \"stripe\", \"manual\"."
        },
        {
          "name": "BillingReference",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Provider-side subscription/order id, if any."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DeactivatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 256
        },
        {
          "name": "DeactivatedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ModuleKey",
          "type": "string",
          "nullable": false,
          "maxLength": 50,
          "description": "Key from ModuleKeys / ModuleCatalog."
        },
        {
          "name": "MonthlyPrice",
          "type": "decimal",
          "nullable": false,
          "description": "Monthly price agreed at activation."
        },
        {
          "name": "NextBillingUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500,
          "description": "Free-form notes (e.g. \"comped for pilot\", \"invoice #123\")."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Active",
            "Inactive",
            "PendingPayment",
            "PastDue"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "Organizations",
      "entity": "Organization",
      "description": "The organization (company account) that owns all of this data.",
      "scopedBy": "e.Id == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BillingCustomerId",
          "type": "string",
          "nullable": true
        },
        {
          "name": "BillingEmail",
          "type": "string",
          "nullable": true
        },
        {
          "name": "BillingProvider",
          "type": "string",
          "nullable": true,
          "description": "\"stripe\" once a subscription exists; null while trial/comped/manual."
        },
        {
          "name": "BillingStatus",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Trial",
            "Active",
            "PastDue",
            "Suspended",
            "Comped"
          ]
        },
        {
          "name": "BillingSubscriptionId",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IncludedSeats",
          "type": "integer",
          "nullable": false,
          "description": "Seats (active users) covered by the base plan; extra active users are billed per seat."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LogoContentType",
          "type": "string",
          "nullable": true
        },
        {
          "name": "LogoPath",
          "type": "string",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "PastDueSinceUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TrialEndsUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        }
      ]
    },
    {
      "name": "OrganizationSettings",
      "entity": "OrganizationSettings",
      "description": "The organization's settings: company details, invoicing, tax and feature options.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AllowNegativeInventory",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "AllowPartialPayments",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "BlockedStates",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "CounterSalesMode",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DefaultDepositPercentage",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "DefaultPaymentInstructions",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DefaultPaymentTerms",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DefaultTaxRate",
          "type": "decimal",
          "nullable": false,
          "description": "Default Tax Rate (%)"
        },
        {
          "name": "DeviceLeaseDays",
          "type": "integer",
          "nullable": false,
          "description": "Days a field device may stay unsynced before it locks to read-only; enforced by the mobile app (Phase 3)."
        },
        {
          "name": "EmailReplyToAddress",
          "type": "string",
          "nullable": true,
          "maxLength": 256,
          "description": "Reply-To Email Address"
        },
        {
          "name": "Industry",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobsDisplayName",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "OperationMode",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "ServiceProvider",
            "Distributor",
            "Hybrid"
          ]
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PaymentProcessingEnabled",
          "type": "boolean",
          "nullable": false,
          "description": "Enable Payment Processing"
        },
        {
          "name": "PaymentProcessor",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "None",
            "Square",
            "Stripe"
          ]
        },
        {
          "name": "PaymentReceiptEmailTemplate",
          "type": "string",
          "nullable": true
        },
        {
          "name": "RequireDepositOnOrders",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "RequireTwoFactor",
          "type": "boolean",
          "nullable": false,
          "description": "When true, every browser sign-in (web host and desktop installs) must use an authenticator app: a user without one is held on the setup page until they enrol, and cannot turn it off."
        },
        {
          "name": "SalesOrdersDisplayName",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "SendPaymentReceipts",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SetupCompletedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp."
        },
        {
          "name": "ShowJobsMenu",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ShowSalesOrdersMenu",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "SquareApplicationId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "SquareEnvironment",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Sandbox",
            "Production"
          ]
        },
        {
          "name": "SquareLocationId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaxCustomCharges",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "TaxLabor",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "TaxMaterials",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "UpdatedDate",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "OutboundTextMessages",
      "entity": "OutboundTextMessage",
      "description": "One outbound SMS to a customer, org-scoped and synced (table \"OutboundTextMessages\").",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Body",
          "type": "string",
          "nullable": false,
          "maxLength": 1600,
          "description": "Message text."
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": true,
          "references": "Customers.Id"
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "DeliveredUtc",
          "type": "datetime",
          "nullable": true,
          "description": "Server-authoritative."
        },
        {
          "name": "Error",
          "type": "string",
          "nullable": true,
          "maxLength": 500,
          "description": "Provider/relay failure text when Status is Failed (server-authoritative)."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": true,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "Kind",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "OnMyWay"
          ]
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ProviderMessageId",
          "type": "string",
          "nullable": true,
          "maxLength": 100,
          "description": "Provider-side message id once accepted (server-authoritative)."
        },
        {
          "name": "RequestedById",
          "type": "string",
          "nullable": true,
          "maxLength": 450,
          "description": "AspNetUsers.Id of the requesting user (string PK, preserved across devices)."
        },
        {
          "name": "RequestedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the requesting user, carried for cross-device FK resolution."
        },
        {
          "name": "RequestedUtc",
          "type": "datetime",
          "nullable": false,
          "description": "UTC timestamp."
        },
        {
          "name": "SentUtc",
          "type": "datetime",
          "nullable": true,
          "description": "Server-authoritative."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Queued",
            "Sent",
            "Delivered",
            "Failed"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "ToNumber",
          "type": "string",
          "nullable": false,
          "maxLength": 20,
          "description": "Destination in E.164 form (\"+17065551212\"); see Flex.Messaging.PhoneNumbers."
        }
      ]
    },
    {
      "name": "Payments",
      "entity": "Payment",
      "description": "Represents a payment transaction processed through Square or other payment processors",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Amount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Currency",
          "type": "string",
          "nullable": false,
          "maxLength": 3
        },
        {
          "name": "CustomerEmail",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": false,
          "references": "Customers.Id"
        },
        {
          "name": "CustomerPhone",
          "type": "string",
          "nullable": true,
          "maxLength": 20
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "ErrorMessage",
          "type": "string",
          "nullable": true,
          "maxLength": 2000
        },
        {
          "name": "FailedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "InvoiceId",
          "type": "integer",
          "nullable": true,
          "references": "Invoices.Id"
        },
        {
          "name": "InvoiceSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Invoices row that InvoiceId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "IsRefund",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "JobId",
          "type": "integer",
          "nullable": true,
          "references": "Jobs.Id"
        },
        {
          "name": "JobSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Jobs row that JobId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 1000
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ProcessedById",
          "type": "string",
          "nullable": true,
          "maxLength": 450,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "ProcessedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that ProcessedById points at."
        },
        {
          "name": "RefundedPaymentId",
          "type": "integer",
          "nullable": true,
          "references": "Payments.Id"
        },
        {
          "name": "RefundedPaymentSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Payments row that RefundedPaymentId points at."
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": true,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SquareOrderId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "SquarePaymentId",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "SquareReceiptUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "Completed",
            "Failed",
            "Refunded",
            "PartiallyRefunded",
            "Cancelled"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Type",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "FullPayment",
            "Deposit",
            "BalancePayment",
            "PartialPayment",
            "Refund"
          ]
        }
      ]
    },
    {
      "name": "PresetProperties",
      "entity": "PresetProperty",
      "description": "A saved mapping from a CSV column name to an item property, used by imports.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CsvColumnName",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "DataType",
          "type": "string",
          "nullable": false,
          "maxLength": 20
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        }
      ]
    },
    {
      "name": "PriceTierGroupCalculations",
      "entity": "PriceTierGroupCalculation",
      "description": "An arithmetic formula applied to ONE tier of a price tier group (Bulk Pricing).",
      "scopedBy": "e.PriceTierGroup.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Formula",
          "type": "string",
          "nullable": false,
          "maxLength": 300
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MinQuantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "PriceTierGroupId",
          "type": "integer",
          "nullable": false,
          "references": "PriceTierGroups.Id"
        },
        {
          "name": "PriceTierGroupSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PriceTierGroups row that PriceTierGroupId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "PriceTierGroupMembers",
      "entity": "PriceTierGroupMember",
      "description": "Membership of an item template in a price tier group.",
      "scopedBy": "e.PriceTierGroup.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "PriceTierGroupId",
          "type": "integer",
          "nullable": false,
          "references": "PriceTierGroups.Id"
        },
        {
          "name": "PriceTierGroupSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PriceTierGroups row that PriceTierGroupId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "PriceTierGroups",
      "entity": "PriceTierGroup",
      "description": "A \"like items\" group for quantity tier pricing (Bulk Pricing).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "PropertyCalculations",
      "entity": "PropertyCalculation",
      "description": "A formula that calculates a property value from other properties, variables and reference tables.",
      "scopedBy": "(e.Property != null && (e.Property.Item != null && e.Property.Item.OrganizationId == org) || (e.Property.BundleTemplateItem != null && e.Property.BundleTemplateItem.BundleTemplate.OrganizationId == org) || (e.Property.KitItem != null && e.Property.KitItem.Kit.OrganizationId == org)) || (e.TemplateProperty != null && e.TemplateProperty.ItemTemplate.OrganizationId == org)",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Expression",
          "type": "string",
          "nullable": false
        },
        {
          "name": "IsEnabled",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemCatalogPropertyId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCatalogProperty.Id"
        },
        {
          "name": "ItemPropertyId",
          "type": "integer",
          "nullable": true,
          "references": "ItemProperties.Id"
        },
        {
          "name": "ItemPropertySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemProperties row that ItemPropertyId points at."
        },
        {
          "name": "ItemTemplatePropertyId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplateProperties.Id"
        },
        {
          "name": "ItemTemplatePropertySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplateProperties row that ItemTemplatePropertyId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false
        },
        {
          "name": "Priority",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "PurchaseOrderItems",
      "entity": "PurchaseOrderItem",
      "description": "One line of a purchase order: item or bundle template, quantities ordered, shipped and received, and unit price.",
      "scopedBy": "e.PurchaseOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BundleTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "BundleTemplates.Id"
        },
        {
          "name": "BundleTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplates row that BundleTemplateId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 500
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LineTotal",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PurchaseOrderId",
          "type": "integer",
          "nullable": false,
          "references": "PurchaseOrders.Id"
        },
        {
          "name": "PurchaseOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrders row that PurchaseOrderId points at."
        },
        {
          "name": "QuantityOrdered",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "QuantityReceived",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "QuantityShipped",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ReceivedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ShipmentId",
          "type": "integer",
          "nullable": true,
          "references": "PurchaseOrderShipments.Id"
        },
        {
          "name": "ShipmentSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrderShipments row that ShipmentId points at."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "Shipped",
            "Delivered",
            "Received",
            "Cancelled"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "VendorPartNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        }
      ]
    },
    {
      "name": "PurchaseOrders",
      "entity": "PurchaseOrder",
      "description": "A purchase order to a vendor: number, status, dates, destination and totals.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CreatedById points at."
        },
        {
          "name": "Currency",
          "type": "string",
          "nullable": false,
          "maxLength": 3
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DeletedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "DeletedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that DeletedById points at."
        },
        {
          "name": "ExpectedDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ExternalOrderNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrderDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "OrderNumber",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ReceivedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "ReceivedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that ReceivedById points at."
        },
        {
          "name": "ReceivedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ReceivingLocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "ReceivingLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that ReceivingLocationId points at."
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Draft",
            "Ordered",
            "Shipped",
            "PartialShipped",
            "Delivered",
            "PartialReceived",
            "Received",
            "Cancelled"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TotalCost",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "UpdatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "UpdatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that UpdatedById points at."
        },
        {
          "name": "VendorContactEmail",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "VendorContactPhone",
          "type": "string",
          "nullable": true,
          "maxLength": 20
        },
        {
          "name": "VendorId",
          "type": "integer",
          "nullable": true,
          "references": "Vendors.Id"
        },
        {
          "name": "VendorName",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "VendorSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Vendors row that VendorId points at."
        }
      ]
    },
    {
      "name": "PurchaseOrderShipments",
      "entity": "PurchaseOrderShipment",
      "description": "A shipment against a purchase order: shipping company, tracking, dates, status and cost.",
      "scopedBy": "e.PurchaseOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CreatedById points at."
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DeletedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "DeletedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that DeletedById points at."
        },
        {
          "name": "EstimatedDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastStatusCheckDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "LastStatusUpdate",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PurchaseOrderId",
          "type": "integer",
          "nullable": false,
          "references": "PurchaseOrders.Id"
        },
        {
          "name": "PurchaseOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrders row that PurchaseOrderId points at."
        },
        {
          "name": "ShipDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ShippingCompany",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "ShippingCost",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "ShippingCostAllocationMethod",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "ByItemCost",
            "ByItemCount",
            "ByWeight",
            "BySize"
          ],
          "description": "How shipping costs are allocated among items when received"
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Ordered",
            "Pending",
            "Shipped",
            "InTransit",
            "OutForDelivery",
            "Delivered",
            "Cancelled",
            "Returned"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TrackingNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "TrackingUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Weight",
          "type": "decimal",
          "nullable": true
        }
      ]
    },
    {
      "name": "ReceivedItems",
      "entity": "ReceivedItem",
      "description": "A quantity of one purchase-order line received into a location during a receiving session.",
      "scopedBy": "e.ReceivingSession.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBundleId",
          "type": "integer",
          "nullable": true,
          "references": "Bundles.Id"
        },
        {
          "name": "CreatedBundleSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Bundles row that CreatedBundleId points at."
        },
        {
          "name": "DestinationLocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "DestinationLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that DestinationLocationId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PassedQualityCheck",
          "type": "boolean",
          "nullable": true
        },
        {
          "name": "PurchaseOrderItemId",
          "type": "integer",
          "nullable": false,
          "references": "PurchaseOrderItems.Id"
        },
        {
          "name": "PurchaseOrderItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrderItems row that PurchaseOrderItemId points at."
        },
        {
          "name": "QualityNotes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "QuantityReceived",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ReceivedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "ReceivingSessionId",
          "type": "integer",
          "nullable": false,
          "references": "ReceivingSessions.Id"
        },
        {
          "name": "ReceivingSessionSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ReceivingSessions row that ReceivingSessionId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ReceivingSessions",
      "entity": "ReceivingSession",
      "description": "One receiving pass against a purchase order: who received what, when.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CompletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PurchaseOrderId",
          "type": "integer",
          "nullable": false,
          "references": "PurchaseOrders.Id"
        },
        {
          "name": "PurchaseOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the PurchaseOrders row that PurchaseOrderId points at."
        },
        {
          "name": "ReceivedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "ReceivedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that ReceivedById points at."
        },
        {
          "name": "StartedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "InProgress",
            "Completed",
            "Cancelled",
            "PartiallyCompleted"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "ReferenceTables",
      "entity": "ReferenceTable",
      "description": "A reference value (type, key, value and effective dates) that calculations look up.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "EffectiveDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "ExpiryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "Key",
          "type": "string",
          "nullable": false
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Type",
          "type": "string",
          "nullable": false
        },
        {
          "name": "Value",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "SalesOrderItems",
      "entity": "SalesOrderItem",
      "description": "One line of a sales order: item template, quantity ordered, picked and shipped, and price.",
      "scopedBy": "e.SalesOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 500
        },
        {
          "name": "DiscountAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "DiscountPercent",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemId",
          "type": "integer",
          "nullable": true,
          "references": "Items.Id"
        },
        {
          "name": "ItemSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Items row that ItemId points at."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LineTotal",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredItemIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredItemSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredSourceLocationIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "PreferredSourceLocationSyncIds",
          "type": "string",
          "nullable": true
        },
        {
          "name": "QuantityBackordered",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "QuantityOrdered",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "QuantityPicked",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "QuantityShipped",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": false,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UnitCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UnitPrice",
          "type": "decimal",
          "nullable": false
        }
      ]
    },
    {
      "name": "SalesOrders",
      "entity": "SalesOrder",
      "description": "A sales order to a customer: number, dates, status, payment and fulfillment, and totals.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "AmountPaid",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "CreatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CreatedById points at."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CustomerId",
          "type": "integer",
          "nullable": false,
          "references": "Customers.Id"
        },
        {
          "name": "CustomerPONumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CustomerSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Customers row that CustomerId points at."
        },
        {
          "name": "DeliveryAddressId",
          "type": "integer",
          "nullable": true,
          "references": "CustomerAddresses.Id"
        },
        {
          "name": "DeliveryAddressSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the CustomerAddresses row that DeliveryAddressId points at."
        },
        {
          "name": "EmailedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Invoice Emailed At"
        },
        {
          "name": "EmailedTo",
          "type": "string",
          "nullable": true,
          "maxLength": 200,
          "description": "Invoice Emailed To"
        },
        {
          "name": "FulfillmentStatus",
          "type": "string",
          "nullable": true,
          "maxLength": 50,
          "description": "Tracks the aggregate status of all transfers associated with this Sales Order."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "OrderDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "OrderNumber",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "PaymentLinkCreatedAt",
          "type": "datetime",
          "nullable": true,
          "description": "Payment Link Created"
        },
        {
          "name": "PaymentLinkId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "PaymentLinkUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "PaymentStatus",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "PaymentTerms",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "RequestedDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ShippingCost",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "Status",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        },
        {
          "name": "StoreCreditApplied",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SubTotal",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaxAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "TaxRate",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "TotalAmount",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UpdatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "UpdatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that UpdatedById points at."
        },
        {
          "name": "UpdatedDate",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "SalesOrderShipments",
      "entity": "SalesOrderShipment",
      "description": "A shipment of a sales order: carrier, tracking, dates and cost.",
      "scopedBy": "e.SalesOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Carrier",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedById",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedBySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the AspNetUsers row that CreatedById points at."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "EstimatedDeliveryDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": false,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "ShipDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ShippingCost",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "ShippingMethod",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TrackingNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "TransferId",
          "type": "integer",
          "nullable": true,
          "references": "LocationTransferLogs.Id"
        },
        {
          "name": "TransferSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LocationTransferLogs row that TransferId points at."
        },
        {
          "name": "Weight",
          "type": "decimal",
          "nullable": true
        }
      ]
    },
    {
      "name": "SalesOrderSourceLocations",
      "entity": "SalesOrderSourceLocation",
      "description": "A location a sales order is picked from, in priority order.",
      "scopedBy": "e.SalesOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsFullyPicked",
          "type": "boolean",
          "nullable": false,
          "description": "Whether this location has been fully picked"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "description": "Notes about this source location selection"
        },
        {
          "name": "Priority",
          "type": "integer",
          "nullable": false,
          "description": "Priority order for picking (1 = highest priority)"
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": false,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "SalesOrderTransfers",
      "entity": "SalesOrderTransfer",
      "description": "A link between a sales order and a location transfer that picks or ships it.",
      "scopedBy": "e.SalesOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": false,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "ShippedWithoutTracking",
          "type": "boolean",
          "nullable": false,
          "description": "Indicates the user chose to ship without tracking information."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferId",
          "type": "integer",
          "nullable": false,
          "references": "LocationTransferLogs.Id"
        },
        {
          "name": "TransferSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LocationTransferLogs row that TransferId points at."
        },
        {
          "name": "TransferType",
          "type": "string",
          "nullable": false,
          "maxLength": 50
        }
      ]
    },
    {
      "name": "SalesOrderUpdates",
      "entity": "SalesOrderUpdate",
      "description": "An entry on a sales order's timeline (note, status change or other update).",
      "scopedBy": "e.SalesOrder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "CreatedByName",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": false,
          "maxLength": 2000
        },
        {
          "name": "IsInternal",
          "type": "boolean",
          "nullable": false,
          "description": "Internal Note"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "NewStatus",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "OldStatus",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "SalesOrderId",
          "type": "integer",
          "nullable": false,
          "references": "SalesOrders.Id"
        },
        {
          "name": "SalesOrderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the SalesOrders row that SalesOrderId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdateType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "GeneralNote",
            "StatusChange",
            "PaymentUpdate",
            "FulfillmentUpdate",
            "ShipmentUpdate",
            "Return",
            "Cancellation"
          ]
        }
      ]
    },
    {
      "name": "ScheduleGroupMembers",
      "entity": "ScheduleGroupMember",
      "description": "Junction: a user belongs to a ScheduleGroup.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsLead",
          "type": "boolean",
          "nullable": false,
          "description": "Crew lead / foreman flag — shown first on the board."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ScheduleGroupId",
          "type": "integer",
          "nullable": false,
          "references": "ScheduleGroups.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UserId",
          "type": "string",
          "nullable": false,
          "references": "AspNetUsers.Id"
        }
      ]
    },
    {
      "name": "ScheduleGroups",
      "entity": "ScheduleGroup",
      "description": "An organizational grouping of users for scheduling (division, crew, team).",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ColorHex",
          "type": "string",
          "nullable": true,
          "maxLength": 7,
          "description": "Hex color (e.g. \"#2e7d32\") used for calendar/board rendering."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "ParentGroupId",
          "type": "integer",
          "nullable": true,
          "references": "ScheduleGroups.Id"
        },
        {
          "name": "ParentGroupSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ScheduleGroups row that ParentGroupId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "StockAlerts",
      "entity": "StockAlert",
      "description": "A low-stock alert raised when an item template falls below its threshold.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AcknowledgedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "AcknowledgedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CurrentStock",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Active",
            "Acknowledged",
            "Resolved",
            "Dismissed"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "ThresholdLevel",
          "type": "integer",
          "nullable": false
        }
      ]
    },
    {
      "name": "TaskTemplateItems",
      "entity": "TaskTemplateItem",
      "description": "An item template a task template uses, with its quantity and whether it is optional.",
      "scopedBy": "e.TaskTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "IsOptional",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "ItemTemplates.Id"
        },
        {
          "name": "ItemTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemTemplates row that ItemTemplateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "Quantity",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaskTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "TaskTemplates.Id"
        },
        {
          "name": "TaskTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TaskTemplates row that TaskTemplateId points at."
        }
      ]
    },
    {
      "name": "TaskTemplateLaborRates",
      "entity": "TaskTemplateLaborRate",
      "description": "A labor rate a task template uses, with the number of workers and whether it is the lead.",
      "scopedBy": "e.TaskTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "IsLead",
          "type": "boolean",
          "nullable": false,
          "description": "Is Lead Worker"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LaborRateId",
          "type": "integer",
          "nullable": false,
          "references": "LaborRates.Id"
        },
        {
          "name": "LaborRateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LaborRates row that LaborRateId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TaskTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "TaskTemplates.Id"
        },
        {
          "name": "TaskTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TaskTemplates row that TaskTemplateId points at."
        },
        {
          "name": "WorkerCount",
          "type": "integer",
          "nullable": false,
          "description": "Number of Workers"
        }
      ]
    },
    {
      "name": "TaskTemplates",
      "entity": "TaskTemplate",
      "description": "A reusable task (set of labor and materials) that can be added to jobs.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "Category",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "CreatedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DefaultLaborRateId",
          "type": "integer",
          "nullable": true,
          "references": "LaborRates.Id",
          "description": "Default Labor Rate"
        },
        {
          "name": "DefaultLaborRateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the LaborRates row that DefaultLaborRateId points at."
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 1000
        },
        {
          "name": "EstimatedHoursMax",
          "type": "decimal",
          "nullable": false,
          "description": "Estimated Hours (Max)"
        },
        {
          "name": "EstimatedHoursMin",
          "type": "decimal",
          "nullable": false,
          "description": "Estimated Hours (Min)"
        },
        {
          "name": "Instructions",
          "type": "string",
          "nullable": true
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "ModifiedBy",
          "type": "string",
          "nullable": true
        },
        {
          "name": "ModifiedDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 200,
          "description": "Task Name"
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SafetyNotes",
          "type": "string",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        }
      ]
    },
    {
      "name": "TemplateBuilderGlobalCategories",
      "entity": "TemplateBuilderGlobalCategory",
      "description": "Junction table: Links a Template Builder to categories applied to ALL generated items.",
      "scopedBy": "e.TemplateBuilder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": false,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderId",
          "type": "integer",
          "nullable": false,
          "references": "TemplateBuilders.Id"
        },
        {
          "name": "TemplateBuilderSyncId",
          "type": "guid",
          "nullable": false,
          "description": "SyncId of the TemplateBuilders row that TemplateBuilderId points at."
        }
      ]
    },
    {
      "name": "TemplateBuilderProperties",
      "entity": "TemplateBuilderProperty",
      "description": "A property definition within a Template Builder.",
      "scopedBy": "e.TemplateBuilder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DataType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Text",
            "Number",
            "Date",
            "Boolean",
            "Dropdown",
            "MultiSelect"
          ]
        },
        {
          "name": "DefaultValue",
          "type": "string",
          "nullable": true,
          "maxLength": 255
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "ExcludeFromCombinations",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "ExcludeFromName",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "PropertyName",
          "type": "string",
          "nullable": false,
          "maxLength": 255
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderId",
          "type": "integer",
          "nullable": false,
          "references": "TemplateBuilders.Id"
        },
        {
          "name": "TemplateBuilderSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TemplateBuilders row that TemplateBuilderId points at."
        }
      ]
    },
    {
      "name": "TemplateBuilderPropertyOptionCategories",
      "entity": "TemplateBuilderPropertyOptionCategory",
      "description": "Junction table: Links a property option to categories.",
      "scopedBy": "e.TemplateBuilderPropertyOption.TemplateBuilderProperty.TemplateBuilder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": false,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": false,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderPropertyOptionId",
          "type": "integer",
          "nullable": false,
          "references": "TemplateBuilderPropertyOptions.Id"
        },
        {
          "name": "TemplateBuilderPropertyOptionSyncId",
          "type": "guid",
          "nullable": false,
          "description": "SyncId of the TemplateBuilderPropertyOptions row that TemplateBuilderPropertyOptionId points at."
        }
      ]
    },
    {
      "name": "TemplateBuilderPropertyOptions",
      "entity": "TemplateBuilderPropertyOption",
      "description": "An option value for a Template Builder property.",
      "scopedBy": "e.TemplateBuilderProperty.TemplateBuilder.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DisplayOrder",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "IsHidden",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateBuilderPropertyId",
          "type": "integer",
          "nullable": false,
          "references": "TemplateBuilderProperties.Id"
        },
        {
          "name": "TemplateBuilderPropertySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TemplateBuilderProperties row that TemplateBuilderPropertyId points at."
        },
        {
          "name": "Value",
          "type": "string",
          "nullable": false,
          "maxLength": 255
        }
      ]
    },
    {
      "name": "TemplateBuilders",
      "entity": "TemplateBuilder",
      "description": "Template Builder - defines a schema with property options that generates ItemTemplate combinations.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "AdminOnlyCost",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "AdminOnlyPrice",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "CategoryId",
          "type": "integer",
          "nullable": true,
          "references": "ItemCategories.Id"
        },
        {
          "name": "CategorySyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the ItemCategories row that CategoryId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "DeletedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 1000
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete: true means the row was deleted (kept for sync and history)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LastUsedCost",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "LastUsedPrice",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 255
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "TransferApprovals",
      "entity": "TransferApproval",
      "description": "An approval request for a location transfer, and its decision.",
      "scopedBy": "e.Transfer.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ApprovalDate",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ApproverId",
          "type": "string",
          "nullable": true,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationTransferLogId",
          "type": "integer",
          "nullable": false,
          "references": "LocationTransferLogs.Id"
        },
        {
          "name": "RejectionReason",
          "type": "string",
          "nullable": true
        },
        {
          "name": "RequestedDate",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "RequesterId",
          "type": "string",
          "nullable": false,
          "references": "AspNetUsers.Id"
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "Approved",
            "Rejected"
          ]
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "TransferValue",
          "type": "decimal",
          "nullable": false
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "TransferTemplates",
      "entity": "TransferTemplate",
      "description": "A reusable transfer plan: source, destination, waypoints and what is moved.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BundleTemplateId",
          "type": "integer",
          "nullable": true,
          "references": "BundleTemplates.Id"
        },
        {
          "name": "BundleTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplates row that BundleTemplateId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true
        },
        {
          "name": "DestinationLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "DestinationLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that DestinationLocationId points at."
        },
        {
          "name": "HasWaypoints",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "ItemFilters",
          "type": "string",
          "nullable": true
        },
        {
          "name": "KitId",
          "type": "integer",
          "nullable": true,
          "references": "Kits.Id"
        },
        {
          "name": "KitSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Kits row that KitId points at."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SourceLocationId",
          "type": "integer",
          "nullable": true,
          "references": "Locations.Id"
        },
        {
          "name": "SourceLocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that SourceLocationId points at."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TemplateType",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Bundle",
            "Kit"
          ]
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        }
      ]
    },
    {
      "name": "TransferTemplateWaypoints",
      "entity": "TransferTemplateWaypoint",
      "description": "Represents a predefined waypoint in a transfer template",
      "scopedBy": "e.TransferTemplate.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "EstimatedTimeMinutes",
          "type": "integer",
          "nullable": true,
          "description": "Estimated time to reach this waypoint (in minutes) from previous point"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "description": "Additional notes about this waypoint"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "TransferTemplates.Id"
        },
        {
          "name": "TransferTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the TransferTemplates row that TransferTemplateId points at."
        },
        {
          "name": "WaypointOrder",
          "type": "integer",
          "nullable": false,
          "description": "The order of this waypoint in the transfer template (1-based)"
        }
      ]
    },
    {
      "name": "TransferWaypoints",
      "entity": "TransferWaypoint",
      "description": "Represents an intermediate location in a transfer journey between source and destination",
      "scopedBy": "e.Transfer.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ActualArrivalTime",
          "type": "datetime",
          "nullable": true,
          "description": "Actual time items arrived at this waypoint"
        },
        {
          "name": "DepartureTime",
          "type": "datetime",
          "nullable": true,
          "description": "When items departed from this waypoint"
        },
        {
          "name": "EstimatedArrivalTime",
          "type": "datetime",
          "nullable": true,
          "description": "Expected time of arrival at this waypoint"
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "LocationId",
          "type": "integer",
          "nullable": false,
          "references": "Locations.Id"
        },
        {
          "name": "LocationSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Locations row that LocationId points at."
        },
        {
          "name": "LocationTransferLogId",
          "type": "integer",
          "nullable": false,
          "references": "LocationTransferLogs.Id"
        },
        {
          "name": "Notes",
          "type": "string",
          "nullable": true,
          "description": "Additional notes about this waypoint"
        },
        {
          "name": "Status",
          "type": "enum",
          "nullable": false,
          "enumValues": [
            "Pending",
            "Arrived",
            "Departed",
            "Skipped",
            "Cancelled"
          ],
          "description": "Current status of this waypoint in the journey"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "TransferSyncId",
          "type": "guid",
          "nullable": true
        },
        {
          "name": "WaypointOrder",
          "type": "integer",
          "nullable": false,
          "description": "The order of this waypoint in the transfer journey (1-based)"
        }
      ]
    },
    {
      "name": "VendorBundleTemplates",
      "entity": "VendorBundleTemplate",
      "description": "A vendor's offer for a bundle template: part number, price and order quantities.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "BundleTemplateId",
          "type": "integer",
          "nullable": false,
          "references": "BundleTemplates.Id"
        },
        {
          "name": "BundleTemplateSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the BundleTemplates row that BundleTemplateId points at."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "MinimumOrderQuantity",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "OrderMultiple",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "VendorDescription",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "VendorId",
          "type": "integer",
          "nullable": false,
          "references": "Vendors.Id"
        },
        {
          "name": "VendorPartNumber",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "VendorPrice",
          "type": "decimal",
          "nullable": true
        },
        {
          "name": "VendorSyncId",
          "type": "guid",
          "nullable": true,
          "description": "SyncId of the Vendors row that VendorId points at."
        },
        {
          "name": "VendorUrl",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        }
      ]
    },
    {
      "name": "Vendors",
      "entity": "Vendor",
      "description": "A vendor (supplier) the organization buys from.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ContactEmail",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "ContactName",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "ContactPhone",
          "type": "string",
          "nullable": true,
          "maxLength": 20
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "DefaultShippingCompany",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "Description",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "Name",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id"
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "UpdatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "UpdatedBy",
          "type": "string",
          "nullable": true,
          "maxLength": 100
        },
        {
          "name": "Website",
          "type": "string",
          "nullable": true,
          "maxLength": 500
        }
      ]
    },
    {
      "name": "WebhookLogs",
      "entity": "WebhookLog",
      "description": "Audit log for Square webhook events",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ErrorMessage",
          "type": "string",
          "nullable": true,
          "maxLength": 2000
        },
        {
          "name": "EventId",
          "type": "string",
          "nullable": false,
          "maxLength": 200
        },
        {
          "name": "HttpMethod",
          "type": "string",
          "nullable": true,
          "maxLength": 50
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": true,
          "references": "Organizations.Id"
        },
        {
          "name": "PaymentId",
          "type": "integer",
          "nullable": true,
          "references": "Payments.Id"
        },
        {
          "name": "ProcessedAt",
          "type": "datetime",
          "nullable": true
        },
        {
          "name": "ProcessedSuccessfully",
          "type": "boolean",
          "nullable": false
        },
        {
          "name": "RawPayload",
          "type": "string",
          "nullable": false
        },
        {
          "name": "ReceivedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "RetryCount",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "SquarePaymentId",
          "type": "string",
          "nullable": true,
          "maxLength": 200
        },
        {
          "name": "StatusCode",
          "type": "integer",
          "nullable": true
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "WebhookType",
          "type": "string",
          "nullable": false,
          "maxLength": 100
        }
      ]
    },
    {
      "name": "WebhookSubscriptions",
      "entity": "WebhookSubscription",
      "description": "An outbound webhook subscription for an organization.",
      "scopedBy": "e.OrganizationId == org",
      "primaryKey": [
        "Id"
      ],
      "columns": [
        {
          "name": "Id",
          "type": "integer",
          "nullable": false,
          "description": "Primary key, unique within this table."
        },
        {
          "name": "ConsecutiveFailureCount",
          "type": "integer",
          "nullable": false,
          "description": "Consecutive failed deliveries; reset to 0 on any success."
        },
        {
          "name": "CreatedAt",
          "type": "datetime",
          "nullable": false
        },
        {
          "name": "CreatedByUserId",
          "type": "string",
          "nullable": true,
          "maxLength": 450,
          "description": "Identity user id of the creator; nullable for cross-device resolution."
        },
        {
          "name": "EventsCsv",
          "type": "string",
          "nullable": false,
          "maxLength": 1024,
          "description": "Comma-joined event names this subscription wants (see WebhookEvents)."
        },
        {
          "name": "IsActive",
          "type": "boolean",
          "nullable": false,
          "description": "Inactive subscriptions are skipped."
        },
        {
          "name": "IsDeleted",
          "type": "boolean",
          "nullable": false,
          "description": "Soft delete flag (mirrors the sync convention of other pull-only tables)."
        },
        {
          "name": "IsPendingSync",
          "type": "boolean",
          "nullable": false,
          "description": "True if this record has local changes that haven't been pushed to the server."
        },
        {
          "name": "LastDeliveryUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC of the most recent delivery attempt (success or failure), when any."
        },
        {
          "name": "LastSyncedUtc",
          "type": "datetime",
          "nullable": true,
          "description": "UTC timestamp of when this record was last successfully synced."
        },
        {
          "name": "OrganizationId",
          "type": "integer",
          "nullable": false,
          "references": "Organizations.Id",
          "description": "Tenant scope."
        },
        {
          "name": "SyncId",
          "type": "guid",
          "nullable": false,
          "description": "Globally unique identifier for this record across all devices."
        },
        {
          "name": "SyncVersion",
          "type": "integer",
          "nullable": false,
          "description": "Increments each time the record is modified locally."
        },
        {
          "name": "Url",
          "type": "string",
          "nullable": false,
          "maxLength": 2048,
          "description": "Destination URL."
        }
      ]
    }
  ],
  "excludedTables": [
    {
      "name": "ApiIdempotencyRecords",
      "reason": "cached API responses kept 24 hours"
    },
    {
      "name": "ApiKeys",
      "reason": "API key hashes (credentials); keys are listed in Settings → Integrations"
    },
    {
      "name": "ApiRequestLogs",
      "reason": "request log"
    },
    {
      "name": "AspNetRoleClaims",
      "reason": "role claims (the permission catalog is in the product docs)"
    },
    {
      "name": "AspNetUserClaims",
      "reason": "sign-in claims"
    },
    {
      "name": "AspNetUserLogins",
      "reason": "external sign-in links (credentials)"
    },
    {
      "name": "AspNetUserTokens",
      "reason": "authenticator keys and recovery codes (credentials)"
    },
    {
      "name": "LocalAuthTokens",
      "reason": "device sign-in tokens (credentials)"
    },
    {
      "name": "OrganizationExportDownloads",
      "reason": "emailed export download links (token hashes)"
    },
    {
      "name": "OrganizationExportSchedules",
      "reason": "scheduled-export destination credentials (Settings → Export All Data → Schedule)"
    },
    {
      "name": "PendingFkResolutions",
      "reason": "sync bookkeeping"
    },
    {
      "name": "SyncDeletionLogs",
      "reason": "sync bookkeeping"
    },
    {
      "name": "WebhookDeliveries",
      "reason": "delivery log"
    }
  ],
  "excludedColumns": [
    {
      "table": "*",
      "columns": [
        "RowVersion"
      ]
    },
    {
      "table": "AspNetUsers",
      "columns": [
        "PasswordHash",
        "SecurityStamp",
        "ConcurrencyStamp"
      ]
    },
    {
      "table": "OrganizationSettings",
      "columns": [
        "SquareAccessToken"
      ]
    },
    {
      "table": "WebhookSubscriptions",
      "columns": [
        "Secret"
      ]
    }
  ],
  "notExported": [
    {
      "name": "AspNetRoles",
      "reason": "not linked to an organization (system-wide or device-local)"
    },
    {
      "name": "AspNetUserRoles",
      "reason": "not linked to an organization (system-wide or device-local)"
    },
    {
      "name": "SystemSettings",
      "reason": "not linked to an organization (system-wide or device-local)"
    }
  ]
}
