<?php

namespace Modules\User\Entities;
    
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\User\Entities\Bank;
use Modules\Auth\Entities\User;

class BankDetail extends Model
{
    /** @use HasFactory<\Modules\User\Database\Factories\BankDetailFactory> */
    use HasUuids;

    protected $table = 'bank_details';

    /**
     * The attributes that are mass assignable.
     *
     * @var list<string>
     */
    protected $fillable = [
        'user_id',
        'bank_id',
        'account_name',
        'account_number',
        'account_type',
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var list<string>
     */
    protected $hidden = [
    ];

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'user_id' => 'string',
            'bank_id' => 'string',
            'account_name' => 'string',
            'account_number' => 'string',
            'account_type' => 'string',
        ];
    }

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

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