<?php

return [
    "type"           => "document",
    "model"          => App\Models\Document::class,
    "label"          => "Documents",
    "label_singular" => "Document",
    "showStatus"     => FALSE,
    "showSlug"       => FALSE,
    "group"          => "content types",
    "order"          => FALSE,
    "search" => [
        "title" => "title",
        "fields" => [
            "title",
            "description",
        ],
        "relations" => [
            "tags",
            "topics",
            "documentType",
            "country",
        ],
        // "order_fields" => [
        //     "order_date" => "publish_date"
        // ]
    ],
    "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"          => "description",
            "label"         => "Description",
            "type"          => "editor",
            "multiLanguage" => TRUE,
            "preValidation" => "xss_clean|trim",
        ],
        [
            "name"          => "publish_date",
            "label"         => "Publish Date",
            "type"          => "datePicker",
            "inputType"     => "date",
            "validation"    => "nullable",
            "placement"     => "sidebar",
            "info"          => "The time you select here will be considered in Berlin/Brussels timezone (CET/CEST)",
        ],
        [
            "name"          => "expiration_date",
            "label"         => "Expiration Date",
            "type"          => "datePicker",
            "inputType"     => "date",
            "validation"    => "nullable",
            "placement"     => "sidebar",
            "info"          => "The time you select here will be considered in Berlin/Brussels timezone (CET/CEST)",
        ],
        [
            "name"        => "topics",
            "label"       => "Topics",
            "type"        => "multiplePicker",
            "longList"    => TRUE,
            "allowInsert" => FALSE,
            "objectTypes" => ["topics"],
            "order"       => TRUE,
            "maxSize"     => 3
        ],
        // [
        //     "name"        => "topic_id",
        //     "label"       => "Topic",
        //     "type"        => "selectBox",
        //     "contentType" => "topics",
        //     "preValidation" => "trim",
        //     "validation" => "required|integer|min:1",
        //     "inList" => true,
        //     "search" => true,
        //     "sort" => true,
        //     "boxSearch" => true,
        //     "allowInsert" => true
        // ],
        [
            "name"        => "document_type_id",
            "label"       => "Document Type",
            "type"        => "selectBox",
            "contentType" => "documentTypes",
            "preValidation" => "trim",
            "validation" => "required|integer|min:1",
            "inList" => true,
            "search" => true,
            "sort" => true,
            "boxSearch" => true,
            "allowInsert" => true
        ],
        [
            "name"        => "country_id",
            "label"       => "Country",
            "type"        => "selectBox",
            "contentType" => "countries",
            "preValidation" => "trim",
            "validation" => config('app.locale') === 'de' ? "nullable" : "required|integer",
            "inList" => true,
            "search" => true,
            "sort" => true,
            "boxSearch" => true,
            "allowInsert" => true
        ],
        [
            "name"        => "tags",
            "label"       => "Tags",
            "type"        => "multiplePicker",
            "longList"    => TRUE,
            "allowInsert" => TRUE,
            "objectTypes" => ["tags"],
            "order"       => TRUE,
            "maxSize"     => 5
        ],
        [
            "name"      => "documentFile",
            "label"     => "Document",
            "type"      => "mediaPicker",
            "multiple"  => FALSE,
            "mediaType" => "document",
            "placement" => "sidebar",
            "minSize"   => 1,
        ],
        [
            "name"      => "image",
            "label"     => "Cover Image",
            "type"      => "mediaPicker",
            "multiple"  => FALSE,
            "mediaType" => "image",
            "placement" => "sidebar"
        ],
    ],
    "actions"        => [
        "edit", "insert", "delete"
    ]
];
