<?php

namespace App\Models;

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

class OtherCostItem extends Model
{
    protected $fillable = [
        'organization_id',
        'mariachi_group_id',
        'code',
        'name',
        'internal_cost',
        'base_price',
        'is_active',
        'sort_order',
    ];

    protected $casts = [
        'organization_id' => 'integer',
        'mariachi_group_id' => 'integer',
        'internal_cost' => 'float',
        'base_price' => 'float',
        'is_active' => 'boolean',
        'sort_order' => 'integer',
    ];

    public function priceRules(): MorphMany
    {
        return $this->morphMany(CatalogPriceRule::class, 'priceable');
    }

    public function mariachiGroup()
    {
        return $this->belongsTo(MariachiGroup::class);
    }

    public static function defaultCatalog(): array
    {
        return [
            ['code' => 'transporte', 'name' => 'Transporte', 'internal_cost' => 40000, 'base_price' => 40000, 'sort_order' => 10],
        ];
    }
}
