{
  "title": "Document Verification",
  "key": "DOCUMENT_VERIFICATION",
  "fields": [
    {
      "type": "title",
      "label": "Document Verification",
      "key": "document_verification_title"
    },
    {
      "label": "Verification Type",
      "type": "select",
      "key": "verification_type",
      "disabled": false,
      "validators": {
        "required": true
      },
      "properties": {
        "placeholder": "Select document type to verify",
        "readOnly": false
      },
      "options": [
        { "label": "Aadhaar Verification", "value": "Aadhaar Verification" },
        { "label": "PAN Verification", "value": "PAN Verification" },
        { "label": "Passport Verification", "value": "Passport Verification" }
      ],
      "connectedElements": {
        "connectedFields": [
          {
            "actions": [
              {
                "condition": "1",
                "id": "1",
                "key": "FIELD_SHOW",
                "props": {
                  "fieldKey": "pan_number"
                }
              },
              {
                "condition": "NOT(1)",
                "id": "2",
                "key": "FIELD_HIDE",
                "props": {
                  "fieldKey": "pan_number"
                }
              }
            ],
            "key": "pan_number",
            "rules": [
              {
                "id": "1",
                "key": "VALUE_CHECK",
                "props": {
                  "pattern": {
                    "key": "CUSTOM",
                    "pattern": "^(PAN Verification)$"
                  },
                  "value": {
                    "source": {
                      "key": "OBJECT",
                      "props": {
                        "object": {
                          "key": "FORM_DATA",
                          "path": "$.verification_type"
                        }
                      }
                    }
                  }
                }
              }
            ],
            "triggers": ["ON_INIT", "ON_CHANGE"]
          },
          {
            "actions": [
              {
                "condition": "1",
                "id": "1",
                "key": "FIELD_SHOW",
                "props": {
                  "fieldKey": "aadhaar_number"
                }
              },
              {
                "condition": "NOT(1)",
                "id": "2",
                "key": "FIELD_HIDE",
                "props": {
                  "fieldKey": "aadhaar_number"
                }
              }
            ],
            "key": "aadhaar_number",
            "rules": [
              {
                "id": "1",
                "key": "VALUE_CHECK",
                "props": {
                  "pattern": {
                    "key": "CUSTOM",
                    "pattern": "^(Aadhaar Verification)$"
                  },
                  "value": {
                    "source": {
                      "key": "OBJECT",
                      "props": {
                        "object": {
                          "key": "FORM_DATA",
                          "path": "$.verification_type"
                        }
                      }
                    }
                  }
                }
              }
            ],
            "triggers": ["ON_INIT", "ON_CHANGE"]
          },
          {
            "actions": [
              {
                "condition": "1",
                "id": "1",
                "key": "FIELD_SHOW",
                "props": {
                  "fieldKey": "passport_number"
                }
              },
              {
                "condition": "NOT(1)",
                "id": "2",
                "key": "FIELD_HIDE",
                "props": {
                  "fieldKey": "passport_number"
                }
              }
            ],
            "key": "passport_number",
            "rules": [
              {
                "id": "1",
                "key": "VALUE_CHECK",
                "props": {
                  "pattern": {
                    "key": "CUSTOM",
                    "pattern": "^(Passport Verification)$"
                  },
                  "value": {
                    "source": {
                      "key": "OBJECT",
                      "props": {
                        "object": {
                          "key": "FORM_DATA",
                          "path": "$.verification_type"
                        }
                      }
                    }
                  }
                }
              }
            ],
            "triggers": ["ON_INIT", "ON_CHANGE"]
          },
          {
            "actions": [
              {
                "condition": "1",
                "id": "1",
                "key": "FIELD_SHOW",
                "props": {
                  "fieldKey": "date_of_birth"
                }
              },
              {
                "condition": "NOT(1)",
                "id": "2",
                "key": "FIELD_HIDE",
                "props": {
                  "fieldKey": "date_of_birth"
                }
              }
            ],
            "key": "date_of_birth",
            "rules": [
              {
                "id": "1",
                "key": "VALUE_CHECK",
                "props": {
                  "pattern": {
                    "key": "CUSTOM",
                    "pattern": "^(Aadhaar Verification|PAN Verification|Passport Verification)$"
                  },
                  "value": {
                    "source": {
                      "key": "OBJECT",
                      "props": {
                        "object": {
                          "key": "FORM_DATA",
                          "path": "$.verification_type"
                        }
                      }
                    }
                  }
                }
              }
            ],
            "triggers": ["ON_INIT", "ON_CHANGE"]
          },
          {
            "actions": [
              {
                "condition": "1",
                "id": "1",
                "key": "FIELD_SHOW",
                "props": {
                  "fieldKey": "document_upload"
                }
              },
              {
                "condition": "NOT(1)",
                "id": "2",
                "key": "FIELD_HIDE",
                "props": {
                  "fieldKey": "document_upload"
                }
              }
            ],
            "key": "document_upload",
            "rules": [
              {
                "id": "1",
                "key": "VALUE_CHECK",
                "props": {
                  "pattern": {
                    "key": "CUSTOM",
                    "pattern": "^(Aadhaar Verification|PAN Verification|Passport Verification)$"
                  },
                  "value": {
                    "source": {
                      "key": "OBJECT",
                      "props": {
                        "object": {
                          "key": "FORM_DATA",
                          "path": "$.verification_type"
                        }
                      }
                    }
                  }
                }
              }
            ],
            "triggers": ["ON_INIT", "ON_CHANGE"]
          }
        ]
      }
    },
    {
      "label": "PAN Number",
      "type": "text",
      "key": "pan_number",
      "disabled": false,
      "hidden": true,
      "validators": {
        "required": true,
        "pattern": {
          "key": "CUSTOM",
          "pattern": "^[A-Z]{5}[0-9]{4}[A-Z]{1}$"
        }
      },
      "properties": {
        "placeholder": "Enter 10-digit PAN",
        "readOnly": false
      }
    },
    {
      "label": "Aadhaar Number",
      "type": "text",
      "key": "aadhaar_number",
      "disabled": false,
      "hidden": true,
      "validators": {
        "required": true,
        "pattern": {
          "key": "CUSTOM",
          "pattern": "^[0-9]{12}$"
        }
      },
      "properties": {
        "placeholder": "Enter 12-digit Aadhaar",
        "readOnly": false
      }
    },
    {
      "label": "Passport Number",
      "type": "text",
      "key": "passport_number",
      "disabled": false,
      "hidden": true,
      "validators": {
        "required": true,
        "pattern": {
          "key": "CUSTOM",
          "pattern": "^[A-Z][0-9]{7}$"
        }
      },
      "properties": {
        "placeholder": "Enter Passport Number",
        "readOnly": false
      }
    },
    {
      "label": "Date of Birth",
      "type": "date",
      "key": "date_of_birth",
      "disabled": false,
      "hidden": true,
      "validators": {
        "required": true
      },
      "properties": {
        "placeholder": "Select date of birth",
        "readOnly": false,
        "min": {
          "year": 1940,
          "month": 1,
          "day": 1
        },
        "max": {
          "year": 2010,
          "month": 12,
          "day": 31
        }
      }
    },
    {
      "label": "Upload Document",
      "type": "file",
      "key": "document_upload",
      "disabled": false,
      "hidden": true,
      "validators": {
        "required": true
      },
      "properties": {
        "accept": "image/jpeg,image/png,image/jpg,application/pdf",
        "placeholder": "Upload document for verification",
        "readOnly": false
      }
    },
    {
      "label": "Facial Verification",
      "type": "capture",
      "key": "facial_verification",
      "disabled": false,
      "validators": {
        "required": false
      },
      "properties": {
        "containerStyles": "width: 100%; height: 240px; border: 1px dashed #ccc; border-radius: 8px; display: flex; justify-content: center; align-items: center;",
        "buttonText": "Take Selfie",
        "icon": "camera",
        "showMediaFiles": true,
        "uploadFileToServer": true
      }
    },
    {
      "label": "I consent to the processing of my document for verification purposes",
      "type": "checkbox",
      "key": "verification_consent",
      "disabled": false,
      "validators": {
        "required": true
      },
      "properties": {
        "readOnly": false
      }
    },
    {
      "type": "button",
      "label": "Verify Document",
      "key": "verify_button",
      "properties": {
        "variant": "primary",
        "size": "medium",
        "action": "submit"
      }
    }
  ],
  "layout": {
    "type": "vertical",
    "styles": {
      "container": {
        "maxWidth": "800px",
        "margin": "0 auto",
        "padding": "20px",
        "backgroundColor": "#ffffff",
        "borderRadius": "8px"
      }
    }
  }
}
