<?php

namespace App\Models;

use App\Models\Property as ModelsProperty;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Financing extends Model
{
    use HasFactory, SoftDeletes;
    protected $table = "financings";
    protected $fillable  = [
        'id',
        'price',
        'percentage_initial_fee',
        'initial_fee',
        'interest',
        'years_term',
        'payment_method',
        'property_id',
        'entity_status',
    ];

    protected $hidden = [
        'updated_at',
        'deleted_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function property()
    {
        return $this->belongsTo(ModelsProperty::class);
    }

    public function payment_plan()
    {
        return $this->hasOne(PaymentPlans::class);
    }
}
