<?php


return  
    [
        'model' => [
            'model' => \Bixo\App\Models\App::class,
            'table' => 'bixo_app_apps',
            'hidden'=> [],
            'visible' => [],
            'guarded' => ['*'],
            'slugs' => ['slug' => 'name'],
            'dates' => ['deleted_at', 'created_at', 'updated_at'],
            'appends' => [],
            'fillable' => ['company_id',  'name',  'description',  'logo',  'api_tokens',  'whitelist_ips',  'whitelist_urls',  'roles',  'status',  'user_id'],
            'translatables' => [],
            'upload_folder' => 'app/app',
            '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" => "company_id", 
                "type" => "text", 
                "label" => 'app::app.label.company_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "name", 
                "type" => "text", 
                "label" => 'app::app.label.name', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "description", 
                "type" => "text", 
                "label" => 'app::app.label.description', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "logo", 
                "type" => "text", 
                "label" => 'app::app.label.logo', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "api_tokens", 
                "type" => "text", 
                "label" => 'app::app.label.api_tokens', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "whitelist_ips", 
                "type" => "text", 
                "label" => 'app::app.label.whitelist_ips', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "whitelist_urls", 
                "type" => "text", 
                "label" => 'app::app.label.whitelist_urls', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "roles", 
                "type" => "text", 
                "label" => 'app::app.label.roles', 
                'sort' => true,
                'roles' => [],
            ],
        ],

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

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

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

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

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

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

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

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

                ],
            ],
        ],

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

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

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

        'controller' => [
            'provider' => 'Bixo',
            'package' => 'App',
            'module' => 'App',
        ],

         
        'workflow' => [
            'type' => 'workflow',
            'marking_store' => [
                'type' => 'multiple_state',
                'arguments' => ['status'],
                // 'property' => 'status'
            ],
            'supports' => [
                \Bixo\App\Models\App::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'],
                        ]
                    ],
                ],
            ],
        ],
        
        
    ];