<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Team extends Model
{
    protected $fillable = [
        'name',
        'code',
        'flag_url',
        'group_name',
        'community_support',
    ];

    public function homeMatches(): HasMany
    {
        return $this->hasMany(FootballMatch::class, 'home_team_id');
    }

    public function awayMatches(): HasMany
    {
        return $this->hasMany(FootballMatch::class, 'away_team_id');
    }

    public function supporters(): HasMany
    {
        return $this->hasMany(User::class, 'favorite_team_id');
    }

    public function news(): HasMany
    {
        return $this->hasMany(News::class, 'related_team_id');
    }
}
