<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest
 * StructType
 * Meta information extracted from the WSDL
 * - type: ns:RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest
 * @subpackage Structs
 */
class RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest extends AbstractStructBase
{
    /**
     * The kluczRecepty
     * Meta information extracted from the WSDL
     * - choice: kluczRecepty | numerIPozycjaReceptyPapierowej
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var KluczReceptyMT
     */
    public $kluczRecepty;
    /**
     * The numerIPozycjaReceptyPapierowej
     * Meta information extracted from the WSDL
     * - choice: kluczRecepty | numerIPozycjaReceptyPapierowej
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var NumerIPozycjaReceptyPapierowejMT
     */
    public $numerIPozycjaReceptyPapierowej;
    /**
     * Constructor method for RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest
     * @uses RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest::setKluczRecepty()
     * @uses RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest::setNumerIPozycjaReceptyPapierowej()
     * @param KluczReceptyMT $kluczRecepty
     * @param NumerIPozycjaReceptyPapierowejMT $numerIPozycjaReceptyPapierowej
     */
    public function __construct(KluczReceptyMT $kluczRecepty = null, NumerIPozycjaReceptyPapierowejMT $numerIPozycjaReceptyPapierowej = null)
    {
        $this
            ->setKluczRecepty($kluczRecepty)
            ->setNumerIPozycjaReceptyPapierowej($numerIPozycjaReceptyPapierowej);
    }
    /**
     * Get kluczRecepty value
     * @return KluczReceptyMT|null
     */
    public function getKluczRecepty()
    {
        return isset($this->kluczRecepty) ? $this->kluczRecepty : null;
    }
    /**
     * This method is responsible for validating the value passed to the setKluczRecepty method
     * This method is willingly generated in order to preserve the one-line inline validation within the setKluczRecepty 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 validateKluczReceptyForChoiceConstraintsFromSetKluczRecepty($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'numerIPozycjaReceptyPapierowej',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property kluczRecepty can\'t be set as the property %s is already set. Only one property must be set among these properties: kluczRecepty, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set kluczRecepty 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 KluczReceptyMT $kluczRecepty
     * @return RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest
     */
    public function setKluczRecepty(KluczReceptyMT $kluczRecepty = null)
    {
        // validation for constraint: choice(kluczRecepty, numerIPozycjaReceptyPapierowej)
        if ('' !== ($kluczReceptyChoiceErrorMessage = self::validateKluczReceptyForChoiceConstraintsFromSetKluczRecepty($kluczRecepty))) {
            throw new \InvalidArgumentException($kluczReceptyChoiceErrorMessage, __LINE__);
        }
        if (is_null($kluczRecepty) || (is_array($kluczRecepty) && empty($kluczRecepty))) {
            unset($this->kluczRecepty);
        } else {
            $this->kluczRecepty = $kluczRecepty;
        }
        return $this;
    }
    /**
     * Get numerIPozycjaReceptyPapierowej value
     * @return NumerIPozycjaReceptyPapierowejMT|null
     */
    public function getNumerIPozycjaReceptyPapierowej()
    {
        return isset($this->numerIPozycjaReceptyPapierowej) ? $this->numerIPozycjaReceptyPapierowej : null;
    }
    /**
     * This method is responsible for validating the value passed to the setNumerIPozycjaReceptyPapierowej method
     * This method is willingly generated in order to preserve the one-line inline validation within the setNumerIPozycjaReceptyPapierowej 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 validateNumerIPozycjaReceptyPapierowejForChoiceConstraintsFromSetNumerIPozycjaReceptyPapierowej($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'kluczRecepty',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property numerIPozycjaReceptyPapierowej can\'t be set as the property %s is already set. Only one property must be set among these properties: numerIPozycjaReceptyPapierowej, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set numerIPozycjaReceptyPapierowej 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 NumerIPozycjaReceptyPapierowejMT $numerIPozycjaReceptyPapierowej
     * @return RezygnacjaZRealizacjiReceptyNaLekRecepturowyRequest
     */
    public function setNumerIPozycjaReceptyPapierowej(NumerIPozycjaReceptyPapierowejMT $numerIPozycjaReceptyPapierowej = null)
    {
        // validation for constraint: choice(kluczRecepty, numerIPozycjaReceptyPapierowej)
        if ('' !== ($numerIPozycjaReceptyPapierowejChoiceErrorMessage = self::validateNumerIPozycjaReceptyPapierowejForChoiceConstraintsFromSetNumerIPozycjaReceptyPapierowej($numerIPozycjaReceptyPapierowej))) {
            throw new \InvalidArgumentException($numerIPozycjaReceptyPapierowejChoiceErrorMessage, __LINE__);
        }
        if (is_null($numerIPozycjaReceptyPapierowej) || (is_array($numerIPozycjaReceptyPapierowej) && empty($numerIPozycjaReceptyPapierowej))) {
            unset($this->numerIPozycjaReceptyPapierowej);
        } else {
            $this->numerIPozycjaReceptyPapierowej = $numerIPozycjaReceptyPapierowej;
        }
        return $this;
    }
}
