<?php

namespace App\Models\Products;

use App\Models\Applications\Application;
use App\Support\UuidScopeTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Product extends Model {
    use UuidScopeTrait, SoftDeletes;

    protected $dates = [
    ];

    protected $fillable = [
        'name',
        'purpose',
        'usage',
        'normative',
        'producer'
    ];

    protected $hidden = [
        'id'
    ];


    public function applications(): HasMany {
        return $this->hasMany(Application::class);
    }


    public function getApplicationAttribute() {
        return $this->applications()->first();
    }

}
