<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for PotwierdzenieOperacjiWeryfikacjiMT StructType
 * Meta information extracted from the WSDL
 * - documentation: Komunikat zawiera identyfikator zadania utworzonego w P1 związanego z obsługą weryfikacji pakietu recept, albo wynik weryfikacji pakietu recept, Na wynik weryfikacji pakietu recept składa się wynik weryfikacji każdej z recept.
 * @subpackage Structs
 */
class PotwierdzenieOperacjiWeryfikacjiMT extends AbstractStructBase
{
    /**
     * The idZadania
     * Meta information extracted from the WSDL
     * - documentation: Nadany przez System P1 identyfikator zadania związanego z weryfikacją pakietu recept. Wykorzystywany przez systemy zewnętrzne w komunikacji z Systemem P1 do sprawdzania statusu przetwarzania zadania oraz pobierania jego wyników.
     * - choice: idZadania | wynikWeryfikacjiRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $idZadania;
    /**
     * The wynikWeryfikacjiRecept
     * Meta information extracted from the WSDL
     * - choice: idZadania | wynikWeryfikacjiRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var WynikWeryfikacjiReceptMT
     */
    public $wynikWeryfikacjiRecept;
    /**
     * Constructor method for PotwierdzenieOperacjiWeryfikacjiMT
     * @uses PotwierdzenieOperacjiWeryfikacjiMT::setIdZadania()
     * @uses PotwierdzenieOperacjiWeryfikacjiMT::setWynikWeryfikacjiRecept()
     * @param string $idZadania
     * @param WynikWeryfikacjiReceptMT $wynikWeryfikacjiRecept
     */
    public function __construct($idZadania = null, WynikWeryfikacjiReceptMT $wynikWeryfikacjiRecept = null)
    {
        $this
            ->setIdZadania($idZadania)
            ->setWynikWeryfikacjiRecept($wynikWeryfikacjiRecept);
    }
    /**
     * Get idZadania value
     * @return string|null
     */
    public function getIdZadania()
    {
        return isset($this->idZadania) ? $this->idZadania : null;
    }
    /**
     * This method is responsible for validating the value passed to the setIdZadania method
     * This method is willingly generated in order to preserve the one-line inline validation within the setIdZadania method
     * This has to validate that the property which is being set is the only one among the given choices
     * @param mixed $value
     * @return string A non-empty message if the values does not match the validation rules
     */
    public function validateIdZadaniaForChoiceConstraintsFromSetIdZadania($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'wynikWeryfikacjiRecept',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property idZadania can\'t be set as the property %s is already set. Only one property must be set among these properties: idZadania, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set idZadania value
     * This property belongs to a choice that allows only one property to exist. It is
     * therefore removable from the request, consequently if the value assigned to this
     * property is null, the property is removed from this object
     * @throws \InvalidArgumentException
     * @param string $idZadania
     * @return PotwierdzenieOperacjiWeryfikacjiMT
     */
    public function setIdZadania($idZadania = null)
    {
        // validation for constraint: string
        if (!is_null($idZadania) && !is_string($idZadania)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($idZadania, true), gettype($idZadania)), __LINE__);
        }
        // validation for constraint: choice(idZadania, wynikWeryfikacjiRecept)
        if ('' !== ($idZadaniaChoiceErrorMessage = self::validateIdZadaniaForChoiceConstraintsFromSetIdZadania($idZadania))) {
            throw new \InvalidArgumentException($idZadaniaChoiceErrorMessage, __LINE__);
        }
        if (is_null($idZadania) || (is_array($idZadania) && empty($idZadania))) {
            unset($this->idZadania);
        } else {
            $this->idZadania = $idZadania;
        }
        return $this;
    }
    /**
     * Get wynikWeryfikacjiRecept value
     * @return WynikWeryfikacjiReceptMT|null
     */
    public function getWynikWeryfikacjiRecept()
    {
        return isset($this->wynikWeryfikacjiRecept) ? $this->wynikWeryfikacjiRecept : null;
    }
    /**
     * This method is responsible for validating the value passed to the setWynikWeryfikacjiRecept method
     * This method is willingly generated in order to preserve the one-line inline validation within the setWynikWeryfikacjiRecept method
     * This has to validate that the property which is being set is the only one among the given choices
     * @param mixed $value
     * @return string A non-empty message if the values does not match the validation rules
     */
    public function validateWynikWeryfikacjiReceptForChoiceConstraintsFromSetWynikWeryfikacjiRecept($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'idZadania',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property wynikWeryfikacjiRecept can\'t be set as the property %s is already set. Only one property must be set among these properties: wynikWeryfikacjiRecept, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set wynikWeryfikacjiRecept value
     * This property belongs to a choice that allows only one property to exist. It is
     * therefore removable from the request, consequently if the value assigned to this
     * property is null, the property is removed from this object
     * @throws \InvalidArgumentException
     * @param WynikWeryfikacjiReceptMT $wynikWeryfikacjiRecept
     * @return PotwierdzenieOperacjiWeryfikacjiMT
     */
    public function setWynikWeryfikacjiRecept(WynikWeryfikacjiReceptMT $wynikWeryfikacjiRecept = null)
    {
        // validation for constraint: choice(idZadania, wynikWeryfikacjiRecept)
        if ('' !== ($wynikWeryfikacjiReceptChoiceErrorMessage = self::validateWynikWeryfikacjiReceptForChoiceConstraintsFromSetWynikWeryfikacjiRecept($wynikWeryfikacjiRecept))) {
            throw new \InvalidArgumentException($wynikWeryfikacjiReceptChoiceErrorMessage, __LINE__);
        }
        if (is_null($wynikWeryfikacjiRecept) || (is_array($wynikWeryfikacjiRecept) && empty($wynikWeryfikacjiRecept))) {
            unset($this->wynikWeryfikacjiRecept);
        } else {
            $this->wynikWeryfikacjiRecept = $wynikWeryfikacjiRecept;
        }
        return $this;
    }
}
