<?php

namespace App\Domains\Subscription\Models;

use App\Domains\Workspace\Models\Workspace;
use Database\Factories\PlanFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Plan extends Model
{
    /** @use HasFactory<PlanFactory> */
    use HasFactory;

    protected $guarded = ['id'];

    protected $casts = [
        'features' => 'array',
    ];

    protected static function newFactory(): PlanFactory
    {
        return PlanFactory::new();
    }

    /** @return HasMany<Workspace, $this> */
    public function workspaces(): HasMany
    {
        return $this->hasMany(Workspace::class);
    }
}
