<?php

namespace App\Livewire\Cards;

use Livewire\Component;
use App\Models\Card;

class Combo extends Component
{
    public $combo, $card, $card_1, $card_2;

    public function mount($combo)
    {
        $this->combo = $combo;
        $this->card_1 = Card::find($combo->card_ids[0]);
        $this->card_2 = Card::find($combo->card_ids[1]);
        $this->card = $this->card_1;
    }

    public function changeCard()
    {
        if ($this->card->id == $this->card_1->id) {
            $this->card = $this->card_2;
        } else {
            $this->card = $this->card_1;
        }
    }

    public function render()
    {
        return view('livewire.cards.combo');
    }
}
