<?php


return  
    [
        'model' => [
            'model' => \Bixo\Database\Models\Call::class,
            'table' => 'bixo_database_calls',
            'hidden'=> [],
            'visible' => [],
            'guarded' => ['*'],
            'slugs' => ['slug' => 'name'],
            'dates' => ['deleted_at', 'created_at', 'updated_at'],
            'appends' => [],
            'fillable' => ['ref',  'owner_id',  'assigned_at',  'agent_id',  'contacted_at',  'category_id',  'city_id',  'location_id',  'sublocation_id',  'property_id',  'building_no',  'customer_type',  'status',  'color',  'unit',  'plot',  'name',  'mobile',  'phone',  'email',  'notes',  'created_by'],
            'translatables' => [],
            'upload_folder' => 'database/call',
            'uploads' => [
            /*
                    'images' => [
                        'count' => 10,
                        'type'  => 'image',
                    ],
                    'file' => [
                        'count' => 1,
                        'type'  => 'file',
                    ],
            */
            ],

            'casts' => [
             
                'marking'    => 'array',
            
            /*
                'images'    => 'array',
                'file'      => 'array',
            */
            ],

            'revision' => [],
            'perPage' => '20',
            'search'        => [
                'name'  => 'like',
                'status',
            ]
        ],

        'search' => [
            
        ],

        'list' => [
            [
                "key" => "ref", 
                "type" => "text", 
                "label" => 'database::call.label.ref', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "owner_id", 
                "type" => "text", 
                "label" => 'database::call.label.owner_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "assigned_at", 
                "type" => "text", 
                "label" => 'database::call.label.assigned_at', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "agent_id", 
                "type" => "text", 
                "label" => 'database::call.label.agent_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "contacted_at", 
                "type" => "text", 
                "label" => 'database::call.label.contacted_at', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "category_id", 
                "type" => "text", 
                "label" => 'database::call.label.category_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "city_id", 
                "type" => "text", 
                "label" => 'database::call.label.city_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "location_id", 
                "type" => "text", 
                "label" => 'database::call.label.location_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "sublocation_id", 
                "type" => "text", 
                "label" => 'database::call.label.sublocation_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "property_id", 
                "type" => "text", 
                "label" => 'database::call.label.property_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "building_no", 
                "type" => "text", 
                "label" => 'database::call.label.building_no', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "customer_type", 
                "type" => "text", 
                "label" => 'database::call.label.customer_type', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "color", 
                "type" => "text", 
                "label" => 'database::call.label.color', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "unit", 
                "type" => "text", 
                "label" => 'database::call.label.unit', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "plot", 
                "type" => "text", 
                "label" => 'database::call.label.plot', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "name", 
                "type" => "text", 
                "label" => 'database::call.label.name', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "mobile", 
                "type" => "text", 
                "label" => 'database::call.label.mobile', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "phone", 
                "type" => "text", 
                "label" => 'database::call.label.phone', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "email", 
                "type" => "text", 
                "label" => 'database::call.label.email', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "notes", 
                "type" => "text", 
                "label" => 'database::call.label.notes', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "created_by", 
                "type" => "text", 
                "label" => 'database::call.label.created_by', 
                'sort' => true,
                'roles' => [],
            ],
        ],

        'form' => [
            [
                "key" => 'ref',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.ref',
                "placeholder" => 'database::call.placeholder.ref',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'owner_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.owner_id',
                "placeholder" => 'database::call.placeholder.owner_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'assigned_at',
                "element" => 'date_picker',
                "type" => 'date_picker',
                "label" => 'database::call.label.assigned_at',
                "placeholder" => 'database::call.placeholder.assigned_at',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'agent_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.agent_id',
                "placeholder" => 'database::call.placeholder.agent_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'contacted_at',
                "element" => 'date_picker',
                "type" => 'date_picker',
                "label" => 'database::call.label.contacted_at',
                "placeholder" => 'database::call.placeholder.contacted_at',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'category_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.category_id',
                "placeholder" => 'database::call.placeholder.category_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'city_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.city_id',
                "placeholder" => 'database::call.placeholder.city_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'location_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.location_id',
                "placeholder" => 'database::call.placeholder.location_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'sublocation_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.sublocation_id',
                "placeholder" => 'database::call.placeholder.sublocation_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'property_id',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.property_id',
                "placeholder" => 'database::call.placeholder.property_id',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'building_no',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.building_no',
                "placeholder" => 'database::call.placeholder.building_no',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'customer_type',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.customer_type',
                "placeholder" => 'database::call.placeholder.customer_type',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'color',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.color',
                "placeholder" => 'database::call.placeholder.color',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'unit',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.unit',
                "placeholder" => 'database::call.placeholder.unit',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'plot',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.plot',
                "placeholder" => 'database::call.placeholder.plot',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'name',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.name',
                "placeholder" => 'database::call.placeholder.name',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'mobile',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.mobile',
                "placeholder" => 'database::call.placeholder.mobile',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'phone',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.phone',
                "placeholder" => 'database::call.placeholder.phone',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'email',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.email',
                "placeholder" => 'database::call.placeholder.email',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'notes',
                "element" => 'text',
                "type" => 'text',
                "label" => 'database::call.label.notes',
                "placeholder" => 'database::call.placeholder.notes',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
            [
                "key" => 'created_by',
                "element" => 'numeric',
                "type" => 'numeric',
                "label" => 'database::call.label.created_by',
                "placeholder" => 'database::call.placeholder.created_by',
                "rules" => '',
                "group" => "main.main",
                "col" => "6",
                "append" => null,
                "prepend" => null,
                "roles" => [],
                "attributes" => [
                    'wrapper' => [],
                    "label" => [],
                    "element" => [],

                ],
            ],
        ],

        'urls' => [
            'new' => [
                'url' => 'database/call/new',
                'method' => 'GET',
            ],
            'create' => [
                'url' => 'database/call/create',
                'method' => 'GET',
            ],
            'store' => [
                'url' => 'database/call',
                'method' => 'POST',
            ],
            'update' => [
                'url' => 'database/call',
                'method' => 'PUT',
            ],
            'list' => [
                'url' => 'database/call',
                'method' => 'GET',
            ],
            'delete' => [
                'url' => 'database/call',
                'method' => 'DELETE',
            ],
        ],

        'order' => [
            'created_at' => 'database::call.label.created_at',
            'name' => 'database::call.label.name',
            'status' => 'database::call.label.status',
        ],

        'groups' => [
            [
                'icon' => "mdi:account-supervisor-outline",
                'name' => "database::call.groups.main",
                'group' => "main.main",
                'title' => "database::call.groups.main",
            ],
            [
                'icon' => "fe:home",
                'name' => "database::call.groups.details",
                'group' => "main.details",
                'title' => "database::call.groups.details",
            ],
            'images' => [
                'icon' => "fe:home",
                'name' => "database::call.groups.images",
                'group' => "main.images",
                'title' => "database::call.groups.images",
            ],
            'settings' => [
                'icon' => "fe:home",
                'name' => "database::call.groups.settings",
                'group' => "main.settings",
                'title' => "database::call.groups.settings",
            ]
        ],

        'controller' => [
            'provider' => 'Bixo',
            'package' => 'Database',
            'module' => 'Call',
        ],

         
        'workflow' => [
            'type' => 'workflow',
            'marking_store' => [
                'type' => 'multiple_state',
                'arguments' => ['status'],
                // 'property' => 'status'
            ],
            'supports' => [
                \Bixo\Database\Models\Call::class,
            ],
            'places' => [
                'Draft',
                'Pending',
                'Approved',
                'Closed',
                'Published',
                'Archived',
                'Unpublished',
            ],
            'initial_places' => ['Draft'],
            'transitions' => [
                'submit' => [
                    'from' => 'Draft',
                    'to' => 'Pending',
                    'metadata' => [
                        'roles' => [
                            'user' => ['*'],
                        ],
                        'rules' => [
                            'name' => 'required',
                        ]
                    ],
                ],
                'reject' => [
                    'from' => 'Pending',
                    'to' => 'Draft',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser'],
                            'team' => ['admin', 'manager'],
                        ],
                        'form' => [
                            'title' => 'Reject',
                            'button' => [
                                'cancel' > [
                                    'icon' > '',
                                    'varient' > '',
                                    'label' > 'Cancel'
                                ],
                                'submit' > [
                                    'icon' > '',
                                    'varient' > 'primary',
                                    'label' > 'Reject'
                                ]
                            ],
                            'fields' => [
                                'count' => [
                                    "element" => 'select',
                                    "type" => 'select',
                                    "label" => 'advert::advert.label.count',
                                    "placeholder" => 'advert::advert.placeholder.count',
                                    "options" => call_user_func(function () {
                                        return [
                                            1 => ['value' => 1, 'text' => 1],
                                            2 => ['value' => 2, 'text' => 2],
                                            3 => ['value' => 3, 'text' => 3],
                                            4 => ['value' => 4, 'text' => 4],
                                        ];
                                    }),
                                    "col" => "12",
                                ],
                                'comment' => [
                                    "element" => 'textarea',
                                    "type" => 'text',
                                    "required" => 'required',
                                    "label" => 'advert::advert.label.comment',
                                    "placeholder" => 'advert::advert.placeholder.comment',
                                    "col" => "12",
                                ],
                            ],
                        ],
                    ],
                ],
                'approve' => [
                    'from' => 'Pending',
                    'to' => 'Approved',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser'],
                            'team' => ['admin', 'manager'],
                        ]
                    ],
                ],
                'publish' => [
                    'from' => ['Approved', 'Unpublished'],
                    'to' => 'Published',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser'],
                            'team' => ['admin'],
                        ]
                    ],
                ],
                'unpublish' => [
                    'from' => ['Published'],
                    'to' => 'Unpublished',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser', 'admin'],
                            'team' => ['admin'],
                        ]
                    ],
                ],
                'archive' => [
                    'from' => ['Published', 'Unpublished'],
                    'to' => 'Archived',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser', 'admin'],
                            'team' => ['admin'],
                        ]
                    ],
                ],
                'unarchive' => [
                    'from' => ['Archived'],
                    'to' => 'Draft',
                    'metadata' => [
                        'roles' => [
                            'user' => ['superuser', 'admin'],
                            'team' => ['admin'],
                        ]
                    ],
                ],
            ],
        ],
        
         
        'actions' => [
            'copy' => [
                'type' => ['Details', 'List'],
                'label' => 'database::call.action.copy',
                'roles' => [
                    'user' => ['superuser', 'admin'],
                    'team' => ['admin'],
                    'permission' => ['database.call.copy', 'database.call.duplicate'],
                ],
                'form' => [
                    'count' => [
                        "element" => 'select',
                        "type" => 'select',
                        "label" => 'database::call.label.count',
                        "placeholder" => 'database::call.placeholder.count',
                        "options" => call_user_func(function () {
                            return [
                                1 => ['value' => 1, 'text' => 1],
                                2 => ['value' => 2, 'text' => 2],
                                3 => ['value' => 3, 'text' => 3],
                                4 => ['value' => 4, 'text' => 4],
                            ];
                        }),
                        "col" => "12",
                    ],
                    'comment' => [
                        "element" => 'textarea',
                        "type" => 'text',
                        "required" => 'required',
                        "label" => 'database::call.label.comment',
                        "placeholder" => 'database::call.placeholder.comment',
                        "col" => "12",
                    ],
                ],
            ],
            'empty' => [
                'type' => ['List', 'Details'],
                'label' => 'database::call.action.empty',
                'roles' => [
                    'user' => ['superuser'],
                ],
            ],
            
            'section' => [
                'type' => ['Group'],
                'api_url' => '',
                'action' => 'list',
                'label' => 'database::call.action.section',
                'store' => 'main.units',
                'group' => 'main.units'
            ],

        ]
        
    ];