<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Subcategoria extends Model
{
    use HasFactory;

    protected $fillable = [
        'departamento_id',
        'nome',
        'slug',
        'ativo',
    ];

    protected $casts = [
        'ativo' => 'boolean',
    ];

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

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