<?php

namespace App\Models;

use App\Traits\Multitenantable;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;

class TenantPaymentMethod extends Model
{
    use Multitenantable;
    protected $primaryKey = 'uuid';
    public $incrementing = false;
    protected $keyType = 'string';

    protected $fillable = [
        'uuid', 
        'tenant_id', 
        'source_name', 
        'account_number', 
        'receipent_name',
    ];

    protected $casts = [
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];
    
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
    
    public function tenant() {
        return $this->belongsTo(Tenant::class, 'tenant_id', 'uuid');
    }
}
