<?php

namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;

class Milestone extends AbstractModel
{
    use SoftDeletes;

    protected $table = 'milestones';

    /**
     * Get the attributes that should be cast.
     *
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'deleted_at' => 'datetime',
        ];
    }

    public function progress()
    {
        return $this->hasMany(MilestoneProgress::class, 'milestone_id');
    }

    public function rewards()
    {
        return $this->belongsToMany(Reward::class, MilestoneReward::class);
    }
}
