<?php declare(strict_types=1);
/**
 * This file is part of the SplendidBear Websites' projects.
 *
 * Copyright (c) 2019 @ www.splendidbear.org
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace App\Entity;

use App\Repository\StepRepository;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\ManyToOne;

/**
 * Class Step
 *
 * @package  App\Entity
 * @author   Lang <https://www.splendidbear.org>
 * @category Class
 * @license  https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
 * @link     www.splendidbear.org
 * @since    2019. 10. 27.
 */
#[Entity(repositoryClass: StepRepository::class)]
class Step
{
    #[Id, GeneratedValue, Column]
    public private(set) ?int $id = null;

    #[Column(length: 3)]
    public ?int $row = null;

    #[Column(length: 3)]
    public ?int $col = null;

    #[Column(nullable: true)]
    public ?bool $wBomb = null;

    #[Column(length: 10, nullable: true)]
    public ?string $player = null;

    #[Column(type: Types::JSON, nullable: true)]
    public ?array $revealedCells = null;

    #[ManyToOne(inversedBy: 'steps')]
    public ?PlayedGame $playedGame = null;

    #[Column(type: Types::DATETIME_MUTABLE, nullable: true)]
    public ?DateTime $created = null;
}
