<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for PotwierdzenieOperacjiZapisuMT StructType
 * Meta information extracted from the WSDL
 * - documentation: Komunikat zawiera: - identyfikator zadania utworzonego w P1 związanego z obsługą zapisu pakietu recept ALBO - wynik zapisu pakietu recept. Na wynik zapisu pakietu recept składają się: - kod i klucz pakietu recept - klucz
 * każdej z recept - wynik weryfikacji każdej z recept.
 * @subpackage Structs
 */
class PotwierdzenieOperacjiZapisuMT extends AbstractStructBase
{
    /**
     * The idZadania
     * Meta information extracted from the WSDL
     * - documentation: Nadany przez System P1 identyfikator zadania związanego z zapisem pakietu recept. Wykorzystywany przez systemy zewnętrzne w komunikacji z systemem P1 do sprawdzania statusu przetwarzania zadania oraz pobierania jego wyników.
     * - choice: idZadania | wynikZapisuPakietuRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $idZadania;
    /**
     * The wynikZapisuPakietuRecept
     * Meta information extracted from the WSDL
     * - choice: idZadania | wynikZapisuPakietuRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var WynikZapisuPakietuReceptMT
     */
    public $wynikZapisuPakietuRecept;
    /**
     * Constructor method for PotwierdzenieOperacjiZapisuMT
     * @uses PotwierdzenieOperacjiZapisuMT::setIdZadania()
     * @uses PotwierdzenieOperacjiZapisuMT::setWynikZapisuPakietuRecept()
     * @param string $idZadania
     * @param WynikZapisuPakietuReceptMT $wynikZapisuPakietuRecept
     */
    public function __construct($idZadania = null, WynikZapisuPakietuReceptMT $wynikZapisuPakietuRecept = null)
    {
        $this
            ->setIdZadania($idZadania)
            ->setWynikZapisuPakietuRecept($wynikZapisuPakietuRecept);
    }
    /**
     * 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 = [
            'wynikZapisuPakietuRecept',
        ];
        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 PotwierdzenieOperacjiZapisuMT
     */
    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, wynikZapisuPakietuRecept)
        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 wynikZapisuPakietuRecept value
     * @return WynikZapisuPakietuReceptMT|null
     */
    public function getWynikZapisuPakietuRecept()
    {
        return isset($this->wynikZapisuPakietuRecept) ? $this->wynikZapisuPakietuRecept : null;
    }
    /**
     * This method is responsible for validating the value passed to the setWynikZapisuPakietuRecept method
     * This method is willingly generated in order to preserve the one-line inline validation within the setWynikZapisuPakietuRecept 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 validateWynikZapisuPakietuReceptForChoiceConstraintsFromSetWynikZapisuPakietuRecept($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 wynikZapisuPakietuRecept can\'t be set as the property %s is already set. Only one property must be set among these properties: wynikZapisuPakietuRecept, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set wynikZapisuPakietuRecept 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 WynikZapisuPakietuReceptMT $wynikZapisuPakietuRecept
     * @return PotwierdzenieOperacjiZapisuMT
     */
    public function setWynikZapisuPakietuRecept(WynikZapisuPakietuReceptMT $wynikZapisuPakietuRecept = null)
    {
        // validation for constraint: choice(idZadania, wynikZapisuPakietuRecept)
        if ('' !== ($wynikZapisuPakietuReceptChoiceErrorMessage = self::validateWynikZapisuPakietuReceptForChoiceConstraintsFromSetWynikZapisuPakietuRecept($wynikZapisuPakietuRecept))) {
            throw new \InvalidArgumentException($wynikZapisuPakietuReceptChoiceErrorMessage, __LINE__);
        }
        if (is_null($wynikZapisuPakietuRecept) || (is_array($wynikZapisuPakietuRecept) && empty($wynikZapisuPakietuRecept))) {
            unset($this->wynikZapisuPakietuRecept);
        } else {
            $this->wynikZapisuPakietuRecept = $wynikZapisuPakietuRecept;
        }
        return $this;
    }
}
