<?php

namespace App\Domain\Training\Models;

use App\Domain\Shared\Traits\BelongsToAcademy;
use App\Domain\Shared\Traits\HasUuid;
use App\Domain\Training\Enums\ActivityCategory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Activity extends Model
{
    use BelongsToAcademy, HasUuid;

    protected $fillable = [
        'academy_id',
        'name',
        'name_ar',
        'slug',
        'description',
        'description_ar',
        'icon',
        'color',
        'category',
        'is_active',
        'sort_order',
        'metadata',
    ];

    protected $casts = [
        'category' => ActivityCategory::class,
        'is_active' => 'boolean',
        'sort_order' => 'integer',
        'metadata' => 'array',
    ];

    public function participants(): HasMany
    {
        return $this->hasMany(\App\Domain\Participant\Models\Participant::class, 'primary_activity_id');
    }

    public function programs(): HasMany
    {
        return $this->hasMany(TrainingProgram::class, 'activity_id');
    }
}
