<?php

/**
 * This is automatically generated file using the Codific Prototizer
 * PHP version 8
 * @category PHP
 * @author   CODIFIC <info@codific.com>
 * @see     http://codific.com
 */

declare(strict_types=1);

namespace App\Entity;

use App\Entity\Abstraction\AbstractEntity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use Symfony\Component\Serializer\Annotation\Ignore;



// #BlockStart number=107 id=_19_0_3_40d01a2_1635865013512_709267_6457_#_0

// #BlockEnd number=107


#[ORM\Table(name: "`answer_set`")]
#[ORM\Entity(repositoryClass: "App\Repository\AnswerSetRepository")]
#[ORM\HasLifecycleCallbacks]
class AnswerSet extends AbstractEntity
// #BlockStart number=123123 id=_19_0_3_40d01a2_1635865013512_709267_6457_#_1
    // additional implements go here
// #BlockEnd number=123123
{

    #[ORM\Column(name: "`external_id`", type: Types::STRING, nullable: true)]
    protected ?string $externalId = "";

    #[ORM\OneToMany(mappedBy: "answerSet", targetEntity: Answer::class, cascade: ["persist"], fetch: "LAZY", orphanRemoval: false)]
    #[ORM\OrderBy(["order" => "ASC"])]
    #[MaxDepth(1)]
    protected Collection $answerSetAnswers;



    public function __construct()
    {
        $this->answerSetAnswers = new ArrayCollection();
    }

    public function setExternalId(?string $externalId): self
    {
        $this->externalId = $externalId;

        return $this;
    }

    public function getExternalId(): ?string
    {
        return $this->externalId;
    }

    /**
     * Get AnswerSet Answers
     * @return Collection<Answer>
     */
    public function getAnswerSetAnswers(): Collection
    {
        return $this->answerSetAnswers;
    }

    /**
     * Add Answers Answer
     */
    public function addAnswerSetAnswer(Answer $answer): AnswerSet
    {
        $this->answerSetAnswers->add($answer);

        return $this;
    }


    /**
     * This method is a copy constructor that will return a copy object (except for the id field)
     * Note that this method will not save the object
     */
    #[Ignore]
    public function getCopy(?AnswerSet $clone = null): AnswerSet
    {
        if ($clone === null) {
            $clone = new AnswerSet();
        }
        $clone->setExternalId($this->externalId);
// #BlockStart number=108 id=_19_0_3_40d01a2_1635865013512_709267_6457_#_2

// #BlockEnd number=108

        return $clone;
    }

    /**
     * Private to string method auto generated based on the UML properties
     * This is the new way of doing things.
     */
    public function toString(): string
    {
        return "{$this->externalId}";
    }

    /**
     * https://symfony.com/doc/current/validation.html
     * we use php version for validation!!!
     */
    public static function loadValidatorMetadata(ClassMetadata $metadata)
    {

// #BlockStart number=109 id=_19_0_3_40d01a2_1635865013512_709267_6457_#_3
//        to remove constraint use following code
//        unset($metadata->properties['PROPERTY']);
//        unset($metadata->members['PROPERTY']);
// #BlockEnd number=109
    }

    #[Ignore]
    public function getGeneratedFilterFields(): array
    {
        return [
            "_answer_set.id",
        ];
    }

    #[Ignore]
    public function getUploadFields(): array
    {
        return [

        ];
    }
    
    #[Ignore]
    public function getModifiableFields(): array
    {
        return [
        ];
    }

    #[Ignore]
    public function getReadOnlyFields(): array
    {
        return [
            "externalId",
        ];
    }

    #[Ignore]
    public function getParentClasses(): array
    {
        return [

        ];
    }

    #[Ignore]
    public static array $manyToManyProperties = [
    ];


    #[Ignore]
    public static array $childProperties = [
        "answerSetAnswers" => "answerSet",
    ];

// #BlockStart number=110 id=_19_0_3_40d01a2_1635865013512_709267_6457_#_4

    /**
     * The toString method based on the private __toString autogenerated method
     * If necessary override.
     */
    public function __toString(): string
    {
        return $this->toString();
    }

// #BlockEnd number=110

}
