<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class WorkoutSession extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'workout_plan_id',
        'title',
        'description',
        'sort_order',
    ];

    public function plan()
    {
        return $this->belongsTo(WorkoutPlan::class, 'workout_plan_id');
    }

    public function exercises()
    {
        return $this->hasMany(WorkoutExercise::class)->orderBy('sort_order');
    }
}
