<?php

declare(strict_types=1);

namespace App\Models;

use App\Enums\GroupMemberRole;
use Illuminate\Database\Eloquent\Relations\Pivot;

class GroupMember extends Pivot
{
    protected $table = 'group_member';

    protected $fillable = [
        'group_id',
        'member_id',
        'role_in_group',
        'joined_at',
    ];

    protected function casts(): array
    {
        return [
            'role_in_group' => GroupMemberRole::class,
            'joined_at' => 'date',
        ];
    }
}
