<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class BankAccount extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $table = 'bank_accounts';

    protected $fillable = [
        'person_id',
        'bank_name',
        'iban',
        'bic_swift',
        'account_number',
        'routing_number',
        'currency',
        'country_code',
        'holder_name',
        'is_active',
        'notes',
        'meta',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'meta' => 'array',
    ];

    public function person(): BelongsTo
    {
        return $this->belongsTo(\App\Models\Person\Person::class, 'person_id');
    }
}
