{
  "style": "flat",
  "groups": {
    "internal": {
      "label": "Internal Information",
      "value": "Internal fields are for admin eyes only."
    },
    "account": {
      "label": "Account Information",
      "value": "Set the user fields."
    }
  },
  "fields": [
    {
      "table": "participant",
      "frontend_type": "select",
      "backend_type": "string",
      "name": "type",
      "label": "Participant Type",
      "rules": [
        "required"
      ],
      "choices": "{participant_types}",
      "selected": "",
      "empty_value": "--- select ---"
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "first",
      "label": "First Name",
      "rules": [
        "required",
        "regex:/^([ A-ZÀ-Ÿ0-9\\,\\.\\-\\&\\+'\"\\\\\\/]+)$/i"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "last",
      "label": "Last Name",
      "rules": [
        "required",
        "regex:/^([ A-ZÀ-Ÿ0-9\\,\\.\\-\\&\\+'\"\\\\\\/]+)$/i"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "company",
      "label": "Company",
      "rules": [
        "required",
        "regex:/^([ A-ZÀ-Ÿ0-9\\,\\.\\-\\&\\+'\"\\\\\\/]+)$/i"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "email",
      "backend_type": "string",
      "name": "email",
      "label": "Email",
      "rules": [
        "required",
        "email:rfc,filter,dns",
        "unique:core_user,email"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "select",
      "backend_type": "string",
      "name": "country",
      "label": "Country",
      "choices": "{countries}",
      "empty_value": "--- select ---",
      "rules": [
        "required"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "address_1",
      "label": "Address 1",
      "rules": [
        "required"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "address_2",
      "label": "Address 2",
      "rules": []
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "city",
      "label": "City",
      "rules": [
        "required",
        "regex:/^([ A-ZÀ-Ÿ0-9\\,\\.\\-\\&\\+'\"\\\\\\/]+)$/i"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "select",
      "backend_type": "string",
      "name": "state",
      "label": "State",
      "rules": [
        "required_if:country,US,CA"
      ],
      "choices": "{user_states:country}",
      "empty_value": "--- select ---"
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "postal",
      "label": "Zip Code",
      "rules": [
        "required",
        "regex:/^[A-Za-z0-9\\- ]+$/"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "phone1",
      "label": "Phone",
      "rules": [
        "required",
        "regex:/^\\+?[0-9A-Za-z# \\(\\)\\-]{10,}$/"
      ],
      "rules_backend": ["nullable"]
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "string",
      "name": "ssn",
      "label": "SSN",
      "rules": [
        "required_if:country,US,CA",
        "nullable",
        "regex:/^([0-9*]{3}[-*]?[0-9*]{2}[-*]?[0-9*]{4})|([0-9*]{2}[-*]?[0-9*]{7})|([0-9*]{3}[-*]?[0-9*]{3}[-*]?[0-9*]{3})$/i"
      ],
      "rules_backend": [
        "nullable",
        "regex:/^([0-9*]{3}[-*]?[0-9*]{2}[-*]?[0-9*]{4})|([0-9*]{2}[-*]?[0-9*]{7})|([0-9*]{3}[-*]?[0-9*]{3}[-*]?[0-9*]{3})$/i"
      ],
      "sensitive": true,
      "help_block": {
        "text": "Social Security Numbers are stored using the latest AES-256 encryption and housed over a secure network connection."
      }
    },
    {
      "table": "participant",
      "frontend_type": "checkbox",
      "backend_type": "string",
      "name": "agree_confirm_1",
      "label": "Terms and Conditions",
      "label_show": true,
      "rules": [
        "required"
      ],
      "rules_backend": [
        "nullable"
      ],
      "choices": {
        "Accept": "1",
        "Decline": ""
      },
      "help_block": {
        "text": "Please accept the <a href='/terms' target='_blank'>Terms and Conditions</a>."
      }
    },
    {
      "frontend_type": "recaptcha_v2_robot",
      "name": "g-recaptcha-response",
      "label": "ReCaptcha",
      "rules": [
          "bail",
          "ReCaptchaV2Robot"
      ]
    },
    {
      "table": "participant",
      "frontend_type": "textarea",
      "backend_type": "textarea",
      "name": "internal_notes",
      "label": "Notes (Internal use only)",
      "group": "internal",
      "rules": []
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "datetime",
      "name": "created_at",
      "label": "Enrollment Date",
      "group": "internal",
      "rules": [],
      "readonly": true,
      "attr": {
        "readonly": true
      }
    },
    {
      "table": "participant",
      "frontend_type": "text",
      "backend_type": "datetime",
      "name": "updated_at",
      "label": "Last Update On",
      "group": "internal",
      "rules": [],
      "readonly": true,
      "attr": {
        "readonly": true
      }
    },
    {
      "table": "user",
      "frontend_type": "text",
      "backend_type": "datetime",
      "name": "last_login_at",
      "label": "Last Login On",
      "group": "internal",
      "rules": [],
      "readonly": true,
      "attr": {
        "readonly": true
      }
    },
    {
      "table": "user",
      "frontend_type": "select",
      "backend_type": "string",
      "name": "internal",
      "label": "User Type",
      "group": "account",
      "rules": [
        "required"
      ],
      "choices": "{user_types}",
      "empty_value": "--- select ---"
    },
    {
      "table": "user",
      "frontend_type": "select",
      "backend_type": "string",
      "name": "status",
      "label": "User Status",
      "group": "account",
      "rules": [
        "required"
      ],
      "choices": "{user_statuses}",
      "empty_value": "--- select ---"
    },
    {
      "table": "user",
      "frontend_type": "password",
      "backend_type": "string",
      "name": "password",
      "label": "Password",
      "group": "account",
      "rules": [
        "confirmed",
        "min:8"
      ],
      "rules_backend": [
        "nullable",
        "confirmed",
        "min:8"
      ],
      "attr": {
        "placeholder": "For new, it must be at least 8 characters."
      },
      "help_block": {
        "text": "Leave empty if not changing."
      }
    },
    {
      "table": "user",
      "frontend_type": "password",
      "backend_type": "string",
      "name": "password_confirmation",
      "label": "Confirm Password",
      "group": "account",
      "rules": [],
      "help_block": {
        "text": "For changing passwords, enter new password again."
      }
    },
    {
      "frontend_type": "submit",
      "name": "submit",
      "label": "Submit",
      "attr": {
        "id": "submit-participant",
        "class": "btn btn-primary pl-4 pr-4"
      },
      "wrapper": {
        "class": "form-button text-right"
      }
    }
  ]
}