<?php

return [
    "type"           => "resource",
    "model"          => App\Models\Backoffice\Resource::class,
    "label"          => "Resources",
    "label_singular" => "Resource",
    "group"          => "content",
    "order"          => FALSE,
    "search" => [
        "fields" => [
            "title",
        ],
    ],
    "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"          => "type",
            "label"         => "Resource Type",
            "type"          => "selectBox",
            "list"          => [
                "psychological_health"   => "Psychological Health",
                "mindfulness" => "Mindfulness",
                "podcasts"  => "Podcasts"
            ],
            "defaultValue"  => "psychological_health",
            "mandatory"     => TRUE,
            "inList"        => TRUE,
            "preValidation" => "trim",
            "validation"    => ""
        ],
        [
            "name"          => "description",
            "label"         => "Description",
            "type"          => "editor",
            "multiLanguage" => TRUE,
            "preValidation" => "xss_clean|trim",
            "inList"        => FALSE,
            "search"        => FALSE,
            "sort"          => FALSE,
        ],
        [
            "name"          => "image",
            "label"         => "Image",
            "type"          => "mediaPicker",
            "multiple"      => FALSE,
            "mediaType"     => "image",
        ],
        [
            "name"          => "address",
            "label"         => "Address",
            "type"          => "textBox",
            "maxLength"     => 250,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "max:250",
            "inList"        => FALSE,
            "search"        => FALSE,
            "sort"          => FALSE,
            "conditions"     => [
                [
                    "type"  =>      "and",
                    "field" =>      "type",
                    "operator" =>   "in",
                    "value" =>      ["psychological_health"]
                ]
            ]
        ],
        [
            "name"          => "phone_number",
            "label"         => "Phone Number",
            "type"          => "textBox",
            "maxLength"     => 50,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "max:50",
            "inList"        => FALSE,
            "search"        => FALSE,
            "sort"          => FALSE,
            "conditions"     => [
                [
                    "type"  =>      "and",
                    "field" =>      "type",
                    "operator" =>   "in",
                    "value" =>      ["psychological_health"]
                ]
            ]
        ],
        [
            "name"        => "cities",
            "label"       => "Cities",
            "type"        => "multiplePicker",
            "allowInsert" => FALSE,
            "objectTypes" => ["city"],
            "order"       => TRUE,
            "maxSize"     => 3,
            "conditions"     => [
                [
                    "type"  =>      "and",
                    "field" =>      "type",
                    "operator" =>   "in",
                    "value" =>      ["psychological_health"]
                ]
            ]
        ],
        [
            "name"        => "links",
            "label"       => "Links",
            "type"        => "multiplePicker",
            "allowInsert" => TRUE,
            "objectTypes" => ["link"],
            "order"       => TRUE,
        ],
    ],
    "actions"        => [
        "edit", "order", "insert", "delete"
    ]
];
