<?php

declare(strict_types=1);

namespace App\Models\Barangay;

use App\Models\Model;

class RequestType extends Model
{
    protected ?string $table = 'barangay_request_types';

    protected array $fillable = [
        'name', 'code', 'description', 'base_fee',
        'processing_days', 'is_active', 'requires_clearance',
    ];

    protected array $casts = [
        'base_fee'          => 'decimal:2',
        'processing_days'   => 'integer',
        'is_active'         => 'boolean',
        'requires_clearance' => 'boolean',
    ];

    public function documentRequests()
    {
        return $this->hasMany(DocumentRequest::class, 'request_type_id');
    }

    public function scopeActive($query)
    {
        return $query->where('is_active', true);
    }
}
