<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Package extends Model
{
    protected $fillable = [
        'name', 'slug', 'short_description', 'full_description',
        'price', 'tier', 'thumbnail_path', 'is_custom', 'is_active',
    ];

    protected $casts = [
        'price'     => 'decimal:2',
        'is_custom' => 'boolean',
        'is_active' => 'boolean',
    ];

    public function orderItems()
    {
        return $this->hasMany(OrderItem::class);
    }

    public function getFormattedPriceAttribute(): string
    {
        return '$' . number_format($this->price, 2);
    }
}
