<?php

namespace App\Models\Fish;

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

class SpeciesPrey extends Model
{
    protected $table = 'species_prey';

    protected $fillable = [
        'predator_id',
        'prey_species_id',
        'strength',
        'context',
    ];

    protected $casts = [
        'strength' => 'decimal:2',
    ];

    public function predator(): BelongsTo
    {
        return $this->belongsTo(Species::class, 'predator_id');
    }

    public function prey(): BelongsTo
    {
        return $this->belongsTo(Species::class, 'prey_species_id');
    }
}
