{
  "format": "pricekit-template",
  "schemaVersion": "1.0",
  "engineVersion": "1",
  "createdWithVersion": "1.0.0",
  "template": {
    "templateId": "85b4bddc-33c9-43ec-ba8f-bd39cf2ef4ed",
    "templateVersion": "1.0"
  },
  "calculator": {
    "name": "نقل أثاث",
    "description": "سعر النقل حسب حجم المنزل والمسافة والطوابق والخدمات الإضافية.",
    "currency": "USD",
    "calculatorVersion": 1,
    "moneyDecimals": 2,
    "allowNegativeTotal": false,
    "fields": [
      {
        "key": "home_size",
        "label": "حجم المنزل",
        "type": "singleChoice",
        "required": true,
        "options": [
          {
            "key": "option_1",
            "label": "غرفة واحدة"
          },
          {
            "key": "option_2",
            "label": "شقة غرفتين"
          },
          {
            "key": "option_3",
            "label": "شقة 3 غرف"
          },
          {
            "key": "option_4",
            "label": "منزل كبير أو فيلا"
          }
        ],
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "distance",
        "label": "المسافة بين الموقعين",
        "description": "أول 10 كم مشمولة في السعر.",
        "type": "number",
        "required": true,
        "defaultValue": {
          "type": "number",
          "value": 10
        },
        "constraints": {
          "min": 1,
          "max": 500
        },
        "unit": "كم",
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "floor_from",
        "label": "الطابق في الموقع الحالي",
        "type": "number",
        "required": true,
        "defaultValue": {
          "type": "number",
          "value": 0
        },
        "constraints": {
          "min": 0,
          "max": 30
        },
        "unit": "طابق",
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "floor_to",
        "label": "الطابق في الموقع الجديد",
        "type": "number",
        "required": true,
        "defaultValue": {
          "type": "number",
          "value": 0
        },
        "constraints": {
          "min": 0,
          "max": 30
        },
        "unit": "طابق",
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "elevator",
        "label": "يوجد مصعد في الموقعين",
        "type": "boolean",
        "required": false,
        "defaultValue": {
          "type": "boolean",
          "value": false
        },
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "dismantle",
        "label": "فك وتركيب الأثاث",
        "type": "boolean",
        "required": false,
        "defaultValue": {
          "type": "boolean",
          "value": false
        },
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "packing",
        "label": "تغليف الأثاث",
        "type": "boolean",
        "required": false,
        "defaultValue": {
          "type": "boolean",
          "value": false
        },
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      },
      {
        "key": "storage_days",
        "label": "تخزين مؤقت",
        "type": "number",
        "required": true,
        "defaultValue": {
          "type": "number",
          "value": 0
        },
        "constraints": {
          "min": 0,
          "max": 90
        },
        "unit": "يوم",
        "visibleByDefault": true,
        "enabledByDefault": true,
        "customerVisible": true
      }
    ],
    "rules": [
      {
        "key": "when_dismantle",
        "name": "فك وتركيب الأثاث",
        "enabled": true,
        "when": {
          "mode": "all",
          "items": [
            {
              "type": "condition",
              "subject": {
                "kind": "field",
                "key": "dismantle"
              },
              "operator": "equals",
              "operand": {
                "type": "boolean",
                "value": true
              }
            }
          ]
        },
        "then": [
          {
            "action": "activateComponent",
            "target": "dismantle_price"
          }
        ]
      },
      {
        "key": "when_packing",
        "name": "تغليف الأثاث",
        "enabled": true,
        "when": {
          "mode": "all",
          "items": [
            {
              "type": "condition",
              "subject": {
                "kind": "field",
                "key": "packing"
              },
              "operator": "equals",
              "operand": {
                "type": "boolean",
                "value": true
              }
            }
          ]
        },
        "then": [
          {
            "action": "activateComponent",
            "target": "packing_price"
          }
        ]
      },
      {
        "key": "when_extra_price",
        "name": "رسوم الطوابق بدون مصعد",
        "enabled": true,
        "when": {
          "mode": "all",
          "items": [
            {
              "type": "condition",
              "subject": {
                "kind": "field",
                "key": "elevator"
              },
              "operator": "equals",
              "operand": {
                "type": "boolean",
                "value": false
              }
            }
          ]
        },
        "then": [
          {
            "action": "activateComponent",
            "target": "extra_price"
          }
        ]
      }
    ],
    "components": [
      {
        "key": "home_size_price",
        "label": "حجم المنزل",
        "stage": "base",
        "pricing": {
          "type": "singleChoice",
          "field": "home_size",
          "options": [
            {
              "option": "option_1",
              "amount": 110
            },
            {
              "option": "option_2",
              "amount": 220
            },
            {
              "option": "option_3",
              "amount": 330
            },
            {
              "option": "option_4",
              "amount": 550
            }
          ]
        },
        "activeByDefault": true,
        "customerVisible": true
      },
      {
        "key": "distance_price",
        "label": "المسافة بين الموقعين",
        "stage": "base",
        "pricing": {
          "type": "tiers",
          "mode": "progressive",
          "quantity": {
            "kind": "field",
            "key": "distance"
          },
          "allowGaps": false,
          "tiers": [
            {
              "from": 0,
              "to": 10,
              "amount": 0
            },
            {
              "from": 10,
              "to": 50,
              "amount": 1.5
            },
            {
              "from": 50,
              "amount": 1
            }
          ]
        },
        "activeByDefault": true,
        "customerVisible": true
      },
      {
        "key": "dismantle_price",
        "label": "فك وتركيب الأثاث",
        "stage": "base",
        "pricing": {
          "type": "fixedAmount",
          "amount": 70
        },
        "activeByDefault": false,
        "customerVisible": true
      },
      {
        "key": "packing_price",
        "label": "تغليف الأثاث",
        "stage": "base",
        "pricing": {
          "type": "fixedAmount",
          "amount": 80
        },
        "activeByDefault": false,
        "customerVisible": true
      },
      {
        "key": "storage_days_price",
        "label": "تخزين مؤقت",
        "stage": "base",
        "pricing": {
          "type": "unitRate",
          "quantity": {
            "kind": "field",
            "key": "storage_days"
          },
          "rate": 8
        },
        "activeByDefault": true,
        "customerVisible": true
      },
      {
        "key": "extra_price",
        "label": "رسوم الطوابق بدون مصعد",
        "stage": "base",
        "pricing": {
          "type": "unitRate",
          "quantity": {
            "kind": "derived",
            "key": "calc_floors"
          },
          "rate": 10
        },
        "activeByDefault": false,
        "customerVisible": true
      }
    ],
    "derivedValues": [
      {
        "key": "calc_floors",
        "label": "عدد الطوابق",
        "type": "number",
        "phase": "prePricing",
        "expression": {
          "type": "arithmetic",
          "operator": "add",
          "left": {
            "type": "ref",
            "ref": {
              "kind": "field",
              "key": "floor_from"
            }
          },
          "right": {
            "type": "ref",
            "ref": {
              "kind": "field",
              "key": "floor_to"
            }
          }
        }
      }
    ],
    "outputs": []
  }
}