<?php

namespace App\Models;

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

class MembershipTier extends Model
{
    protected $fillable = [
        'name', 'slug', 'description', 'price_cents', 'currency',
        'billing_period', 'is_featured', 'badge_text', 'cta_variant',
        'sort_order', 'is_active',
    ];

    protected function casts(): array
    {
        return [
            'is_featured' => 'boolean',
            'is_active' => 'boolean',
        ];
    }

    public function features(): HasMany
    {
        return $this->hasMany(MembershipTierFeature::class)->orderBy('sort_order');
    }
}
