<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class LeadStage extends Model
{
    protected $casts = ['is_active' => 'boolean', 'is_terminal' => 'boolean'];
    public function scopeActive($query) { return $query->where('is_active', true); }
    use HasFactory;

    protected $table = 'lead_stages';

    protected static function booted(): void
    {
        static::addGlobalScope('currentLeadStatuses', function ($query) {
            $query->where('lead_stages.id', '<=', 7);
        });
    }
}
