<?php

return [
    "type"           => "formFields",
    "model"          => App\Models\FormField::class,
    "label"          => "Form Fields",
    "label_singular" => "Form Field",
    "group"          => "none",
    "parent" => array(
        "field" => "form_section_id",
        "contentType" => "formSections"
    ),
    "order"          => TRUE,

    "search" => [],

    "fields" => [
        [
            "name"          => "title",
            "label"         => "Title",
            "type"          => "textBox",
            "maxLength"     => 150,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "required|max:150",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "label",
            "label"         => "Field Label",
            "type"          => "textBox",
            "maxLength"     => 250,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "required|max:250",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "field_type",
            "label"         => "Field Type",
            "type"          => "selectBox",
            "list"          => [
                "text"      => "Text Input (Single Line)",
                "textarea"  => "Text Input (Textarea)",
                "radio"     => "Radio Buttons",
                "checkbox"  => "Checkboxes",
                "email"     => "Email Input",
                "members"   => "Members (Company Selection)"
            ],
            "defaultValue"  => "text",
            "preValidation" => "trim",
            "validation"    => "required|in:text,textarea,radio,checkbox,email,members",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "is_mandatory",
            "label"         => "Mandatory Field",
            "type"          => "checkBox",
            "validation"    => "nullable|boolean",
            "placement"     => "sidebar",
            "defaultValue"  => FALSE
        ],
        [
            "name"          => "layout",
            "label"         => "Field Layout",
            "type"          => "selectBox",
            "list"          => [
                "single" => "Single Column",
                "double" => "Two Columns"
            ],
            "defaultValue"  => "single",
            "preValidation" => "trim",
            "validation"    => "nullable|in:single,double",
            "placement"     => "sidebar"
        ],
        [
            "name"          => "conditional_field_dependent_id",
            "label"         => "Conditional Field",
            "type"          => "textBox",
            "maxLength"     => 150,
            "multiLanguage" => FALSE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "max:150",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE,
            "info"          => "The ID of the dependent field for conditional logic (not spaces, lowercase ex: id_unique_name)"
        ],
        [
            "name"        => "fieldOptions",
            "label"       => "Field Options",
            "type"        => "singlePicker",
            "objectType"  => "fieldOptions",
            "order"       => TRUE,
            "parent"      => [
                "name"   => "field_type",
                "values" => [
                    "radio",
                    "checkbox",
                ]
            ]
        ],
    ],

    "actions" => [
        "edit", "insert", "delete"
    ]
];
