<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GameShot extends Model
{
    protected $fillable = [
        'game_session_id',
        'shot_number',
        'result',
    ];

    /*
    |---------------------------
    | Relationships
    |---------------------------
    */

    // Each shot belongs to a session
    public function session()
    {
        return $this->belongsTo(GameSession::class, 'game_session_id');
    }

    /*
    |---------------------------
    | Helper methods
    |---------------------------
    */

    // Check if this shot is a goal
    public function isGoal()
    {
        return (bool) $this->result;
    }
}
