<?php

namespace App\Models;

use App\Enums\SupplierApplicationStatus;
use App\Enums\SupplierType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class SupplierApplication extends Model
{
    use HasFactory;

    protected $fillable = [
        'company_name',
        'contact_name',
        'email',
        'phone',
        'nif',
        'province_id',
        'supplier_type',
        'product_category',
        'website',
        'company_description',
        'products_description',
        'supply_capacity',
        'message',
        'attachment_path',
        'status',
        'notes',
    ];

    protected $casts = [
        'status' => SupplierApplicationStatus::class,
        'supplier_type' => SupplierType::class,
        'replied_at' => 'datetime',
    ];

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