<?php
    return [
        "type"           => "block",
        "model"          => App\Models\Backoffice\Block::class,
        "label"          => "content_types.block_plural",
        "label_singular" => "content_types.block_singular",
        "group"          => "content",
        "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",
                    "blockSliderAdvertisement" => "Block Slider Advertisement",
                    "blockAdvertisement" => "Block Advertisement",
                    "blockHighlightedArticle" => "Block Highlighted Article",
                    "blockCategoriesList" => "Block Categories List",
                    "blockArticlesList" => "Block Articles List",
                    "blockEventsList" => "Block Events List",
                    "blockNewsletterForm" => "Block Newsletter Form",
                    "blockResultsTwoColumns" => "Block Results Two Columns",
                    "blockJobsTwoColumns" => "Block Jobs Two Columns",
                    "blockSliderCards" => "Block Slider Cards",
                    "blockCompetitionsTwoColumns" => "Block Competitions Two Columns",
                    "blockCardsTwoColumns" => "Block Cards Two Columns",
                    "blockResultsSlider" => "Block Results Slider",
                    "blockSubscriptionPlans" => "Block Subscription Plans",
                ],
                "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,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockLocation",
                            "blockContent",
                            "blockSlider",
                            "blockSliderAdvertisement",
                            "blockAdvertisement",
                            "blockHighlightedArticle",
                            "blockCategoriesList",
                            "blockArticlesList",
                            "blockEventsList",
                            "blockNewsletterForm",
                            "blockResultsTwoColumns",
                            "blockJobsTwoColumns",
                            "blockSliderCards",
                            "blockCompetitionsTwoColumns",
                            "blockCardsTwoColumns",
                            "blockResultsSlider",
                            "blockSubscriptionPlans",
                        ]
                    ]
                ]
            ],
            [
                "name"          => "subject",
                "label"         => "Block Subject",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "nullable|max:150",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCompetitionsTwoColumns",
                            "blockCardsTwoColumns",
                            "blockSubscriptionPlans"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "label",
                "label"         => "Label",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "nullable|max:150",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"        => "cardsCompetition",
                "label"       => "Cards",
                "type"        => "multiplePicker",
                "allowInsert" => TRUE,
                "objectTypes" => ["card_competition_item"],
                "order"       => TRUE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockSliderCards"]
                    ]
                ]
            ],
            [
                "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"        => "advertisements",
                "label"       => "Advertisement Slides",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["advertisement"],
                "order"       => TRUE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockSliderAdvertisement", "blockAdvertisement"]
                    ]
                ]
            ],
            [
                "name"        => "subscriptionPlans",
                "label"       => "Subscription Plans",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["sub_plan"],
                "order"       => TRUE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockSubscriptionPlans"]
                    ]
                ]
            ],
            [
                "name"        => "results",
                "label"       => "Results",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["result"],
                "order"       => TRUE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockResultsTwoColumns"]
                    ]
                ]
            ],
            [
                "name"        => "results",
                "label"       => "Results Slides",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["result"],
                "order"       => TRUE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockResultsSlider"]
                    ]
                ]
            ],
            [
                "name"        => "competitions",
                "label"       => "Competitions",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["competition"],
                "order"       => TRUE,
                "maxSize"     => 4,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockCompetitionsTwoColumns"]
                    ]
                ]
            ],
            [
                "name"        => "highlighted_magazine",
                "label"       => "Highlighted Article",
                "type"        => "multiplePicker",
                "allowInsert" => FALSE,
                "objectTypes" => ["article", "event"],
                "websiteObjectRelation" => TRUE,
                "order"       => TRUE,
                "maxSize"     => 1,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      ["blockHighlightedArticle"]
                    ]
                ]
            ],
            [
                "name"          => "content",
                "label"         => "Content",
                "type"          => "editor",
                "multiLanguage" => TRUE,
                "preValidation" => "xss_clean|trim",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns",
                        ]
                    ]
                ],
            ],
            [
                "name"          => "link",
                "label"         => "Link",
                "type"          => "link",
                "objectTypes"   => ["category", "article", "event", "page", "competition", "result"],
                "required"      => false,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockEventsList",
                            "blockResultsTwoColumns",
                            "blockCardsTwoColumns",
                            "blockCompetitionsTwoColumns",
                        ]
                    ]
                ]
            ],
            /* [
                "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"         => "Image",
                "type"          => "mediaPicker",
                "baseFolder"    => "default",
                "multiple"      => FALSE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCompetitionsTwoColumns",
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "second_title",
                "label"         => "Second Title",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:150",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "second_subject",
                "label"         => "Second Subject",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:150",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "second_label",
                "label"         => "Second Label",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:150",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "second_content",
                "label"         => "Second Content",
                "type"          => "editor",
                "multiLanguage" => TRUE,
                "preValidation" => "xss_clean|trim",
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "second_link",
                "label"         => "Second Link",
                "type"          => "link",
                "objectTypes"   => ["category", "article", "event", "page"],
                "required"      => false,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "secondImage",
                "label"         => "Second Image",
                "type"          => "mediaPicker",
                "baseFolder"    => "default",
                "multiple"      => FALSE,
                "conditions"     => [
                    [
                        "type"  =>      "and",
                        "field" =>      "type",
                        "operator" =>   "in",
                        "value" =>      [
                            "blockCardsTwoColumns"
                        ]
                    ]
                ]
            ],
            [
                "name"          => "textItems",
                "label"         => "Text Items",
                "type"          => "repeater",
                "objectType"    => "text_item",
                "order"         => true,
                "conditions"    => [
                    [
                        "type"      => "and",
                        "field"     => "type",
                        "operator"  => "in",
                        "value"     => [""]
                    ]
                ]
            ]
        ],
        "actions"        => [
            "edit", "insert", "delete"
        ]
    ];
