<?php

namespace Kylin\Community\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Kylin\Community\Enums\ActivityStatus;

/**
 * 社区活动
 */
class Activity extends Model
{
    protected $fillable = [
        'title',
        'content',
        'type',
        'start_time',
        'end_time',
        'location',
        'max_participants',
        'status',
        'cover_image',
    ];

    protected function casts(): array
    {
        return [
            'start_time' => 'datetime',
            'end_time' => 'datetime',
            'status' => ActivityStatus::class,
        ];
    }

    public function signUps(): HasMany
    {
        return $this->hasMany(ActivitySignUp::class);
    }

    public function signIns(): HasMany
    {
        return $this->hasMany(ActivitySignIn::class);
    }
}
