<?php

namespace App\Models;

use App\Models\BaseModel;

class PriceLevel extends BaseModel
{
    protected $fillable = [
        'company_id','name','description','is_default','is_active'
    ];

    protected $casts = [
        'is_default' => 'boolean',
        'is_active'  => 'boolean',
    ];

    public function company()    { return $this->belongsTo(Company::class); }
    public function customers()  { return $this->hasMany(Customer::class); }
    public function itemPrices() { return $this->hasMany(ItemPriceLevel::class); }

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