<?php

namespace App\Models\Companies;

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

class CompanyType extends Model {
    public const APPLICANT = 'applicant';
    public const PRODUCER = 'producer';

    public const TITLES = [
        self::APPLICANT => 'Заявитель',
        self::PRODUCER => 'Изготовитель продукции'
    ];

    protected $dates = [
    ];

    protected $fillable = [
        'company_id',
        'name'
    ];

    protected $hidden = [
    ];

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


    public function getTitleAttribute(): ?string {
        return self::TITLES[$this->name] ?? null;
    }


}