<?php

    return [
        "type"           => "product",
        "model"          => App\Models\Product::class,
        "label"          => "products",
        "label_singular" => "product",
        "template"       => false,
        "hierarchic"     => false,
        "group"          => "products",
        "order"          => true,
        "showSlug"       => true,
        "showUri"        => false,
        "baseUri"        =>[
            'en' => '/products',
        ],
        "search" => [
            "title" => 'block_title',
            "fields" => [
                "block_title",
                "description_title",
                "description"
            ],
            "relations" => [
                "productBlocks"
            ]
        ],
        "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"          => "block_title",
                "label"         => "frontend 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_title",
                "label"         => "Description title",
                "type"          => "textBox",
                "maxLength"     => 50,
                "multiLanguage" => true,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "required|max:50",
            ],
            [
                "name"          => "description",
                "label"         => "description",
                "type"          => "editor",
                "multiLanguage" => true,
                "preValidation" => "xss_clean|trim",
                "validation"    => "required|htmlMax:200",
            ],
            [
                "name"          => "price",
                "label"         => "price",
                "type"          => "textBox",
                "multiLanguage" => false,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "regex:/^\d+(\.\d{1,2})?$/",
            ],
            [
                "name"          => "product_group_id",
                "label"         => "Product Model",
                "type"          => "selectBox",
                "contentType"   => "productGroup",
                "placement"     => "sidebar",
                "allowInsert"   => true,
            ],
            [
                "name"          => "productTags",
                "label"         => "Tags",
                "type"          => "multiplePicker",
                "longList"      => true,
                "allowInsert"   => true,
                "objectTypes"   => ["tags"],
                "placement"     => "sidebar",
                "order"         => false
            ],
            [
                "name"          => "components",
                "label"         => "Components",
                "type"          => "multiplePicker",
                "longList"      => true,
                "allowInsert"   => true,
                "objectTypes"   => ["component"],
                "placement"     => "sidebar",
                "order"         => false
            ],
            [
                "name"      => "highlightImage",
                "label"     => "Highlight image",
                "type"      => "mediaPicker",
                "multiple"  => false,
                "mediaType" => "image",
            ],
            [
                "name"      => "otherImages",
                "label"     => "Other images (2)",
                "type"      => "mediaPicker",
                "multiple"  => true,
                "maxSize"   => 2,
                "minSize"   => 2,
                "mediaType" => "image",
            ],
            [
                "name"          => "relatedProducts",
                "label"         => "related products",
                "type"          => "multiplePicker",
                "longList"      => true,
                "allowInsert"   => false,
                "objectTypes"   => ["product"],
                "placement"     => "sidebar",
                "order"         => true
            ],
            [
                "name"          => "bluetooth_version_id",
                "label"         => "Bluetooth Version",
                "type"          => "selectBox",
                "contentType"    => "bluetoothVersion",
                "placement"     => "sidebar",
                "allowInsert"   => true,
            ],
            [
                "name"          => "productBlocks",
                "label"         => "Blocks",
                "type"          => "multiplePicker",
                "longList"      => true,
                "allowInsert"   => true,
                "objectTypes"   => ["blocks"],
                "order"         => true
            ],
            [
                "name"          => "otherVersions",
                "label"         => "Other bluetooth versions",
                "type"          => "multiplePicker",
                "longList"      => false,
                "allowInsert"   => true,
                "objectTypes"   => ["product"],
                "order"         => true
            ],
            [
                "name"          => "version_description",
                "label"         => "Version description",
                "type"          => "textBox",
                "maxLength"     => 150,
                "multiLanguage" => true,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "required|max:150",
            ],
            [
                "name"          => "buy_now_link",
                "label"         => "Buy now link",
                "type"          => "link",
                "maxLabel"     => 100,
                "multiLanguage" => true,
                "objectTypes"   => [
                    "product"
                ],
                "required"      => false,
            ],
            [
                "name"          => "quick_start_label",
                "label"         => "Quick start Label",
                "type"          => "textBox",
                "maxLength"     => 50,
                "multiLanguage" => true,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "required_with:quickStart|max:50",
            ],
            [
                "name"      => "quickStart",
                "label"     => "Quick start guide",
                "type"      => "mediaPicker",
                "multiple"  => false,
                "mediaType" => "document",
            ],
            [
                "name"          => "other_link",
                "label"         => "Other link",
                "type"          => "link",
                "maxLabel"     => 100,
                "multiLanguage" => true,
                "objectTypes"   => [
                    "product"
                ],
                "required"      => false,
            ],
        ],
        "actions"        => [
            "insert", "edit", "delete", "order"
        ]
    ];
