{
  "steps": [
    {
      "id": "welcome",
      "order": 0,
      "title": "Benvenuto",
      "description": "",
      "type": "intro",
      "fields": [],
      "attachments": [],
      "pricing": [],
      "next": "taxpayer"
    },

    {
      "id": "taxpayer",
      "order": 1,
      "title": "Dati contribuente e dichiarazione precedente",
      "description": "",
      "fields": [
        { "key": "prevPreparedByUs", "type": "boolean", "required": true },
        { "key": "prevDeclaration", "type": "file", "requiredIf": { "prevPreparedByUs": false } },

        { "key": "taxpayer.firstName", "type": "string", "required": true },
        { "key": "taxpayer.lastName", "type": "string", "required": true },
        { "key": "taxpayer.birthDate", "type": "date", "required": true },
        { "key": "taxpayer.address", "type": "string", "required": true },
        { "key": "taxpayer.zip", "type": "string", "required": true },
        { "key": "taxpayer.city", "type": "string", "required": true }
      ],
      "attachments": ["prevDeclaration"],
      "pricing": [],
      "next": "marital"
    },

    {
      "id": "marital",
      "order": 2,
      "title": "Stato civile",
      "description": "",
      "fields": [
        { "key": "maritalStatus", "type": "enum", "values": ["SINGLE", "MARRIED", "PARTNERED"], "required": true },

        { "key": "spouse.firstName", "type": "string", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } },
        { "key": "spouse.lastName", "type": "string", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } },
        { "key": "spouse.birthDate", "type": "date", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } },
        { "key": "spouse.address", "type": "string", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } },
        { "key": "spouse.zip", "type": "string", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } },
        { "key": "spouse.city", "type": "string", "requiredIf": { "maritalStatus": ["MARRIED","PARTNERED"] } }
      ],
      "attachments": [],
      "pricing": [
        { "amountCHF": 10, "condition": { "maritalStatus": ["MARRIED","PARTNERED"] } }
      ],
      "next": "children"
    },

    {
      "id": "children",
      "order": 3,
      "title": "Figli",
      "description": "",
      "fields": [
        { "key": "hasChildren", "type": "boolean", "required": true },

        {
          "key": "children",
          "type": "array",
          "maxItems": 5,
          "item": {
            "firstName": "string",
            "lastName": "string",
            "birthDate": "date",
            "sameHousehold": "boolean",
            "addressIfDifferent": "string",
            "school": "string",
            "careCosts": "file"
          }
        },

        { "key": "moreThanFiveChildrenNote", "type": "string", "required": false }
      ],
      "attachments": ["children[*].careCosts"],
      "pricing": [
        { "amountCHF": 5, "perItem": "children" }
      ],
      "next": "income"
    },

    {
      "id": "income",
      "order": 4,
      "title": "Redditi",
      "description": "",
      "fields": [
        {
          "key": "incomeTypes",
          "type": "array",
          "values": ["EMPLOYED", "SELF_EMPLOYED", "PENSIONER", "UNEMPLOYED"]
        },

        { "key": "employment.percent", "type": "number", "requiredIf": { "incomeTypes": "EMPLOYED" } },
        { "key": "employment.detailsUnder70", "type": "string", "requiredIf": { "employment.percent": "<70" } }
      ],
      "attachments": [
        "salaryCertificate",
        "accountingDocuments",
        "avsCertificate",
        "lppCertificate",
        "unemploymentCertificate"
      ],
      "pricing": [],
      "next": "professionalExpenses"
    },

    {
      "id": "professionalExpenses",
      "order": 5,
      "title": "Spese professionali",
      "description": "",
      "fields": [
        { "key": "expensesChanged", "type": "boolean", "required": true },
        { "key": "workplaceDescription", "type": "string", "requiredIf": { "expensesChanged": true } },
        { "key": "commuteMethod", "type": "enum", "values": ["CAR", "BUS", "BIKE", "WALK"] },
        { "key": "commuteKm", "type": "number" },
        { "key": "lunchAtHome", "type": "boolean" },
        { "key": "eatsOut", "type": "boolean" },
        { "key": "hasCanteenOrVouchers", "type": "boolean", "requiredIf": { "eatsOut": true } }
      ],
      "attachments": ["transportSubscription"],
      "pricing": [],
      "next": "sideIncome"
    },

    {
      "id": "sideIncome",
      "order": 6,
      "title": "Reddito accessorio",
      "description": "",
      "fields": [
        { "key": "hasSideIncome", "type": "boolean", "required": true }
      ],
      "attachments": ["sideIncomeDocuments"],
      "pricing": [
        { "amountCHF": 5, "condition": { "hasSideIncome": true } }
      ],
      "next": "annuities"
    },

    {
      "id": "annuities",
      "order": 7,
      "title": "Rendite",
      "description": "",
      "fields": [
        { "key": "hasAnnuities", "type": "boolean", "required": true }
      ],
      "attachments": ["annuityDocuments"],
      "pricing": [
        { "amountCHF": 5, "condition": { "hasAnnuities": true } }
      ],
      "next": "insurance"
    },

    {
      "id": "insurance",
      "order": 8,
      "title": "Spese assicurative e mediche",
      "description": "",
      "fields": [],
      "attachments": ["healthInsuranceCertificate", "medicalExpenses"],
      "pricing": [
        { "amountCHF": 5, "condition": { "medicalExpenses": true } }
      ],
      "next": "pillar3"
    },

    {
      "id": "pillar3",
      "order": 9,
      "title": "Polizze 3A / 3B",
      "description": "",
      "fields": [
        { "key": "hasPillar3", "type": "boolean", "required": true }
      ],
      "attachments": ["pillar3Documents"],
      "pricing": [
        { "amountCHF": 5, "condition": { "hasPillar3": true } }
      ],
      "next": "bankAccounts"
    },

    {
      "id": "bankAccounts",
      "order": 10,
      "title": "Conti bancari",
      "description": "",
      "fields": [
        { "key": "hasBankAccounts", "type": "boolean", "required": true }
      ],
      "attachments": ["bankStatements"],
      "pricing": [
        { "amountCHF": 2, "perExtraAttachmentAfter": 2 }
      ],
      "next": "otherAssets"
    },

    {
      "id": "otherAssets",
      "order": 11,
      "title": "Altri beni / averi",
      "description": "",
      "fields": [
        { "key": "hasOtherAssets", "type": "boolean", "required": true },
        { "key": "otherAssetsList", "type": "array", "item": { "description": "string", "amount": "number" } }
      ],
      "attachments": ["otherAssetsDocuments"],
      "pricing": [
        { "amountCHF": 5, "perItem": "otherAssetsList" }
      ],
      "next": "debts"
    },

    {
      "id": "debts",
      "order": 12,
      "title": "Debiti / ipoteche",
      "description": "",
      "fields": [
        { "key": "hasDebts", "type": "boolean", "required": true }
      ],
      "attachments": ["debtCertificates"],
      "pricing": [
        { "amountCHF": 5, "perAttachment": true }
      ],
      "next": "properties"
    },

    {
      "id": "properties",
      "order": 13,
      "title": "Immobili",
      "description": "",
      "fields": [
        { "key": "hasProperties", "type": "boolean", "required": true },
        {
          "key": "propertiesList",
          "type": "array",
          "item": {
            "country": "enum",
            "address": "string",
            "purchaseYear": "number",
            "buildingYear": "number",
            "isRented": "boolean"
          }
        }
      ],
      "attachments": ["propertyDocuments", "deed", "maintenanceInvoices"],
      "pricing": [
        { "amountCHF": 5, "condition": { "country": "SWISS" } },
        { "amountCHF": 7, "condition": { "country": "ITALY" } },
        { "amountCHF": 7, "condition": { "country": "FOREIGN" } }
      ],
      "next": "foreign"
    },

    {
      "id": "foreign",
      "order": 14,
      "title": "Redditi o averi all’estero",
      "description": "",
      "fields": [
        { "key": "hasForeignAssets", "type": "boolean", "required": true },
        { "key": "foreignDescription", "type": "string", "requiredIf": { "hasForeignAssets": true } }
      ],
      "attachments": ["foreignDocuments"],
      "pricing": [
        { "amountCHF": 5, "perAttachment": true }
      ],
      "next": null
    }
  ]
}
