<?php

namespace App\Forms\Customer\Wallet;

class CouponForm extends WalletForm
{
  public function __construct()
  {
    parent::__construct();
  }
  public function action_init_process(string $action, array $formDatas = []): void
  {
    $fields = [
      "clientinfo_uid",
      "title",
      "amount",
      "status",
      "content",
    ];
    $filters = [
      "clientinfo_uid",
      "status",
    ];
    $indexFilter     = $filters;
    $actionButtons = ['view' => ICONS['SEARCH']];
    $batchjobFilters = ['status'];
    switch ($action) {
      case 'create':
      case 'create_form':
      case 'modify':
      case 'modify_form':
        break;
      case 'view':
        $fields = [...$fields, 'created_at'];
        break;
      case 'index':
      case 'download':
        $fields = [
          "clientinfo_uid",
          "title",
          "amount",
          "status",
          'created_at'
        ];
        break;
    }
    $this->setFormFields($fields);
    $this->setFormRules($action, $fields);
    $this->setFormFilters($filters);
    $this->setFormOptions($action, $filters, $formDatas);
    $this->setIndexFilters($indexFilter);
    $this->setActionButtons($actionButtons);
    $this->setBatchjobFilters($batchjobFilters);
  }
}
