<?php


return  
    [
        'model' => [
            'model' => \Bixo\Deal\Models\Payment::class,
            'table' => 'bixo_deal_payments',
            'hidden'=> [],
            'visible' => [],
            'guarded' => ['*'],
            'slugs' => ['slug' => 'name'],
            'dates' => ['deleted_at', 'created_at', 'updated_at'],
            'appends' => [],
            'fillable' => ['deal_id',  'ref',  'payment_date',  'amount',  'documents',  'user_id'],
            'translatables' => [],
            'upload_folder' => 'deal/payment',
            '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" => "deal_id", 
                "type" => "text", 
                "label" => 'deal::payment.label.deal_id', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "ref", 
                "type" => "text", 
                "label" => 'deal::payment.label.ref', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "payment_date", 
                "type" => "text", 
                "label" => 'deal::payment.label.payment_date', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "amount", 
                "type" => "text", 
                "label" => 'deal::payment.label.amount', 
                'sort' => true,
                'roles' => [],
            ],
            [
                "key" => "documents", 
                "type" => "text", 
                "label" => 'deal::payment.label.documents', 
                'sort' => true,
                'roles' => [],
            ],
        ],

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

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

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

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

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

                ],
            ],
        ],

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

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

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

        'controller' => [
            'provider' => 'Bixo',
            'package' => 'Deal',
            'module' => 'Payment',
        ],

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