<?php

return [
    "type"           => "country",
    "model"          => App\Models\Country::class,
    "label"          => "Countries",
    "label_singular" => "Country",
    "group"          => "locations",
    "order"          => FALSE,
    "fields"         => [
        [
            "name"          => "title",
            "label"         => "Country name",
            "type"          => "textBox",
            "maxLength"     => 150,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "required|max:150",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "code",
            "label"         => "Country code",
            "info"          => "The unique ISO country code (https://www.iso.org/obp/ui/#search)",
            "type"          => "textBox",
            "maxLength"     => 10,
            "multiLanguage" => FALSE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "required|max:10", //TODO - Add a unique rules that ignores the current record "|unique:App\Models\Country,code",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "main_country",
            "label"         => "Main App country",
            "type"          => "checkBox",
            "inList"        => TRUE,
            "info"          => "Note: Only one country can be the main App country",
        ],

    ],
    "actions"        => [
        "edit", "order", "insert", "delete"
    ]
];
