<?php

namespace App\Models;

use App\Enums\OriginStatusType;
use App\Models\Traits\Filterable;
use App\Models\Traits\SelectOptions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class UserBank extends Model
{
  use HasFactory, Filterable, SelectOptions;

  protected $fillable = [
    'user_id',
    'company_id',
    'bank_id',
    'type',
    'account_number',
    'account_name',
    'branch',
    'status',
  ];

  protected $casts = [
    'status' => OriginStatusType::class,
    'type' => \App\Enums\UserBankType::class,
  ];

  public function user()
  {
    return $this->belongsTo(User::class, 'user_id');
  }

  public function company()
  {
    return $this->belongsTo(Company::class, 'company_id');
  }

  public function bank()
  {
    return $this->belongsTo(Bank::class, 'bank_id');
  }
}
