<?php

namespace App\Entity;

use App\Repository\ConstitueRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: ConstitueRepository::class)]
#[ORM\UniqueConstraint(name: 'unique_constitue', columns: ['mod_id', 'modpack_id'])]
#[UniqueEntity(fields: ['mod', 'modpack'], message: 'relation already exists')]
class Constitue
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column]
    private ?bool $optionnel = null;

    #[ORM\ManyToOne(inversedBy: 'constitues')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Mod $mod = null;

    #[ORM\ManyToOne(inversedBy: 'constitues')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Modpack $modpack = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function isOptionnel(): ?bool
    {
        return $this->optionnel;
    }

    public function setOptionnel(bool $optionnel): static
    {
        $this->optionnel = $optionnel;

        return $this;
    }

    public function getMod(): ?Mod
    {
        return $this->mod;
    }

    public function setMod(?Mod $mod): static
    {
        $this->mod = $mod;

        return $this;
    }

    public function getModpack(): ?Modpack
    {
        return $this->modpack;
    }

    public function setModpack(?Modpack $modpack): static
    {
        $this->modpack = $modpack;

        return $this;
    }
}
