<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Contractor extends Model
{
    protected $fillable = [
        'name', 'contact_person', 'phone', 'email', 'specialty',
        'contract_amount', 'paid_amount', 'project_id',
    ];

    protected function casts(): array
    {
        return [
            'contract_amount' => 'decimal:2',
            'paid_amount' => 'decimal:2',
        ];
    }

    public function project(): BelongsTo
    {
        return $this->belongsTo(Project::class);
    }
}
