<?php

namespace App\Models;

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

class MatchModel extends Model
{
    use HasFactory;

    protected $fillable = [
        'league_name',
        'league_type',
        'team_one_name',
        'team_one_flag',
        'team_two_name',
        'team_two_flag',
        'match_date',
        'match_time',
        'streaming_url',
        'status',
    ];

    protected function casts(): array
    {
        return [
            'status' => 'integer',
            'match_date' => 'date',
        ];
    }

    public function streamingUrls()
    {
        return $this->hasMany(StreamingUrl::class, 'match_id');
    }

}
