<?php

use MintyPHP\Domain\Taxonomy\UserLifecycleAction;
use MintyPHP\Domain\Taxonomy\UserLifecycleStatus;
use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType;

return gridFilterSchema([
    'query' => [
        'limit' => ['type' => 'int', 'default' => 20, 'min' => 1, 'max' => 200],
        'offset' => ['type' => 'int', 'default' => 0, 'min' => 0],
        'search' => ['type' => 'string'],
        'actions' => [
            'type' => 'csv_strings',
            'max' => 200,
            'sanitizer' => gridEnumSanitizer(UserLifecycleAction::class),
        ],
        'statuses' => [
            'type' => 'csv_strings',
            'max' => 200,
            'sanitizer' => gridEnumSanitizer(UserLifecycleStatus::class),
        ],
        'trigger_types' => [
            'type' => 'csv_strings',
            'max' => 200,
            'sanitizer' => gridEnumSanitizer(UserLifecycleTriggerType::class),
        ],
        'actor_user_ids' => ['type' => 'csv_ids', 'max' => 200],
        'created_from' => ['type' => 'date'],
        'created_to' => ['type' => 'date'],
        'order' => ['type' => 'order', 'allowed' => ['created_at', 'status', 'action', 'trigger_type', 'restored_at'], 'default' => 'created_at'],
        'dir' => ['type' => 'dir', 'default' => 'desc'],
    ],
    'toolbar' => [
        [
            'key' => 'search',
            'type' => 'text',
            'label' => 'Search',
            'placeholder' => 'Search...',
            'input_id' => 'user-lifecycle-audit-search',
            'search' => true,
            'query' => ['type' => 'string'],
        ],
        [
            'key' => 'actions',
            'type' => 'multi_csv',
            'label' => 'Action',
            'placeholder' => 'Select actions',
            'input_id' => 'user-lifecycle-audit-actions-filter',
            'options_key' => 'action_items',
            'default' => [],
            'query' => ['type' => 'csv_strings', 'max' => 200, 'return' => 'array'],
        ],
        [
            'key' => 'statuses',
            'type' => 'multi_csv',
            'label' => 'Status',
            'placeholder' => 'Select statuses',
            'input_id' => 'user-lifecycle-audit-statuses-filter',
            'options_key' => 'status_items',
            'default' => [],
            'query' => ['type' => 'csv_strings', 'max' => 200, 'return' => 'array'],
        ],
        [
            'key' => 'trigger_types',
            'type' => 'multi_csv',
            'label' => 'Trigger',
            'placeholder' => 'Select triggers',
            'input_id' => 'user-lifecycle-audit-trigger-types-filter',
            'options_key' => 'trigger_items',
            'default' => [],
            'query' => ['type' => 'csv_strings', 'max' => 200, 'return' => 'array'],
        ],
        [
            'key' => 'actor_user_ids',
            'type' => 'multi_csv',
            'label' => 'Actor',
            'placeholder' => 'Select actor users',
            'input_id' => 'user-lifecycle-audit-actor-user-ids-filter',
            'options_key' => 'actor_items',
            'default' => [],
            'query' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
        ],
        [
            'key' => 'created_from',
            'type' => 'date',
            'label' => 'Created from',
            'input_id' => 'user-lifecycle-audit-created-from',
        ],
        [
            'key' => 'created_to',
            'type' => 'date',
            'label' => 'Created to',
            'input_id' => 'user-lifecycle-audit-created-to',
        ],
    ],
]);
