<?php
    return [
        "type"           => "block",
        "model"          => App\Models\Backoffice\Block::class,
        "label"          => "Blocks",
        "label_singular" => "Block",
        "group"          => "none",
        "order"          => FALSE,
        "isPage"         => FALSE,
        "search" => [
            "fields" => [
                "block_title",
                "content",
            ],
            //The include is basically a filter for the search.
            // If you uncomment the example below is would only add to the search block that have the type in "blockSlider","blockWysiwyg"
            /*
            "include" => [
                "type" => [
                    "blockSlider",
                    "blockContent",
                ]
            ],
            */
            "relations" => [
                "slider",
            ],
            "parentRelationships" => [
                "page",
            ]
        ],
        "fields"         => [
            [
                "name"          => "start_date",
                "label"         => "Start Date",
                "type"          => "datePicker",
                "inputType"     => "date",
                "validation"    => "",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "time",
                "label"         => "Time",
                "type"          => "datePicker",
                "inputType"     => "time",
                "validation"    => "",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "end_date",
                "label"         => "End Date",
                "type"          => "datePicker",
                "inputType"     => "datetime",
                "validation"    => "",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "multi_start_date",
                "label"         => "Multi Start Date",
                "type"          => "datePicker",
                "inputType"     => "date",
                "multiLanguage" => TRUE,
                "validation"    => "",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "multi_time",
                "label"         => "Multi Time",
                "type"          => "datePicker",
                "inputType"     => "time",
                "multiLanguage" => TRUE,
                "validation"    => "nullable",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "multi_end_date",
                "label"         => "Multi End Date",
                "type"          => "datePicker",
                "inputType"     => "datetime",
                "multiLanguage" => TRUE,
                "validation"    => "nullable",
                // "placement"     => "sidebar"
            ],
            [
                "name"          => "title",
                "label"         => "Block Title",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "required|max:150",
                "inList"        => TRUE,
                "search"        => TRUE,
                "sort"          => TRUE
            ],
            [
                "name"          => "is_active_multi",
                "label"         => "Is Active Multi",
                "type"          => "checkBox",
                "validation"    => "nullable|boolean",
                "multiLanguage" => TRUE,
                "inList"        => TRUE,
                "sort"          => TRUE,
            ],
            [
                "name"          => "is_active",
                "label"         => "Is Active",
                "type"          => "checkBox",
                "validation"    => "nullable|boolean",
                "inList"        => TRUE,
                "sort"          => TRUE,
            ],
            [
                "name"          => "type",
                "label"         => "Block Type",
                "type"          => "selectBox",
                "list"          => [
                    "blockSlider"   => "Slider",
                    "blockLocation" => "Location",
                    "blockContent"  => "Editor"
                ],
                "defaultValue"  => "blockSlider",
                "mandatory"     => TRUE,
                "inList"        => TRUE,
                "preValidation" => "trim",
                "validation"    => ""
            ],
            [
                "name"          => "block_title",
                "label"         => "Title",
                "type"          => "textBox",
                "maxLength"     => 300,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:300",
                "inList"        => FALSE,
                "search"        => FALSE,
                "sort"          => FALSE,
                "info"          => 'Something tthtih',
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockLocation", "blockContent"]
                    ]
                ]
            ],
            [
                "name"        => "slider",
                "label"       => "Slides",
                "type"        => "multiplePicker",
                "allowInsert" => TRUE,
                "objectTypes" => ["slider_item"],
                "order"       => TRUE,
                "maxSize"     => 3,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockSlider"]
                    ]
                ]
            ],
            [
                "name"                      => "multi_content",
                "label"                     => "Multi Content",
                "type"                      => "multiplePicker",
                "websiteObjectRelation"     => TRUE,
                "objectTypes"               => ["slider_item", "block", "page"],
                "order"                     => TRUE,
            ],
            [
                "name"          => "content",
                "label"         => "Content",
                "type"          => "editor",
                "multiLanguage" => TRUE,
                "preValidation" => "xss_clean|trim",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockContent"]
                    ]
                ],
                "info"          => "Test something"
            ],
            [
                "name"          => "color",
                "label"         => "Color Picker",
                "type"          => "colorPicker",
                "placement"     => "second tab"
            ],
            [
                "name"          => "multi_color",
                "label"         => "Multi Color Picker",
                "type"          => "colorPicker",
                "multiLanguage" => TRUE,
                "placement"     => "second tab"
            ],
            [
                "name"          => "link",
                "label"         => "Link",
                "type"          => "link",
                "objectTypes"   => ["page"],
                "required"      => false,
                "placement"     => "second tab"
            ],
            [
                "name"          => "multi_link",
                "label"         => "Multi Link",
                "type"          => "link",
                "objectTypes"   => ["page"],
                "multiLanguage" => TRUE,
                "placement"     => "second tab"
            ],
            [
                "name"          => "location",
                "label"         => "Location",
                "type"          => "location",
                "placement"     => "second tab"
            ],
            /*
            [
                "name"          => "image",
                "label"         => "mediaPicker",
                "type"          => "mediaPicker",
                "baseFolder"    => "default",
                "placement"     => "second tab"
            ],
            */
        ],
        "actions"        => [
            "edit", "insert", "delete"
        ]
    ];
