# ===================================
#  Field Definitions
# ===================================

fields:
    name:
        label: Name
        span: left

    code:
        label: Unique Code
        span: right
        preset:
            field: name
            type: slug

tabs:
    defaultTab: Site Definition
    fields:
        _primary_site_hint:
            type: hint
            comment: The primary site is used by default and cannot be deleted.

        is_enabled:
            label: Enabled
            comment: Disabled sites are not shown on the frontend.
            type: switch
            span: left

        is_enabled_edit:
            label: Enabled in the Admin Panel
            comment: Use this if you want the site to be enabled in the admin panel.
            type: switch
            span: right
            trigger:
                action: disable|fill
                field: is_enabled
                condition: checked

        _ruler1:
            type: ruler

        group:
            label: Site Group
            type: relation
            required: true

        theme:
            label: Theme
            type: dropdown
            span: full
            comment: Use the selected theme for this site.

        locale:
            label: Locale
            type: dropdown
            comment: Use this locale code for this site.
            span: full

        _custom_locale:
            span: full
            comment: Specify a custom locale code.
            cssClass: field-indent
            trigger:
                action: show
                field: locale
                condition: value[custom]

        timezone:
            label: Timezone
            type: dropdown
            comment: Use this timezone for this site.
            span: full

        is_custom_url:
            tab: Configuration
            label: Custom application URL
            comment: Override the application URL when this site is active.
            type: checkbox

        app_url:
            tab: Configuration
            span: full
            placeholder: "https://"
            cssClass: field-indent
            trigger:
                action: show
                field: is_custom_url
                condition: checked

        is_prefixed:
            tab: Configuration
            label: Use a CMS route prefix
            comment: A prefix can identify this site when using a shared hostname.
            type: checkbox
            span: full

        route_prefix:
            tab: Configuration
            span: full
            placeholder: /
            cssClass: field-indent
            trigger:
                action: show
                field: is_prefixed
                condition: checked

        is_host_restricted:
            tab: Configuration
            label: Define matching hostnames
            comment: Specify domain names and patterns that must be used to serve this site.
            type: checkbox
            span: full

        allow_hosts:
            tab: Configuration
            type: datatable
            cssClass: field-indent
            trigger:
                action: show
                field: is_host_restricted
                condition: checked
            columns:
                hostname:
                    title: Hostname

        is_role_restricted:
            tab: Configuration
            label: Define administrator roles
            comment: Restrict access to this site to only administrator with the following roles.
            type: checkbox

        allow_roles:
            tab: Configuration
            type: taglist
            cssClass: field-indent
            options: true
            useKey: true
            trigger:
                action: show
                field: is_role_restricted
                condition: checked

        is_styled:
            tab: Configuration
            label: Display a style for this site
            comment: To help identify this site, display a color in the admin panel.
            type: checkbox

        color_background:
            tab: Configuration
            type: colorpicker
            availableColors: ['#16a085', '#27ae60', '#2980b9', '#8e44ad', '#2b3e50', '#f39c12', '#d35400', '#c0392b', '#bdc3c7', '#7f8c8d']
            cssClass: field-indent
            span: left
            trigger:
                action: show
                field: is_styled
                condition: checked

        color_foreground:
            tab: Configuration
            type: colorpicker
            availableColors: ['#1abc9c', '#2ecc71', '#3498db', '#9b59b6', '#34495e', '#f1c40f', '#e67e22', '#e74c3c', '#ecf0f1', '#95a5a6']
            span: right
            trigger:
                action: show
                field: is_styled
                condition: checked
