<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for KryteriaOdczytuPakietuReceptMT StructType
 * Meta information extracted from the WSDL
 * - documentation: Kryteria odczytu pakietu recept.
 * @subpackage Structs
 */
class KryteriaOdczytuPakietuReceptMT extends AbstractStructBase
{
    /**
     * The kluczPakietuRecept
     * Meta information extracted from the WSDL
     * - choice: kluczPakietuRecept | kodPakietuRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $kluczPakietuRecept;
    /**
     * The kodPakietuRecept
     * Meta information extracted from the WSDL
     * - choice: kluczPakietuRecept | kodPakietuRecept
     * - choiceMaxOccurs: 1
     * - choiceMinOccurs: 1
     * - maxOccurs: 1
     * - minOccurs: 0
     * @var string
     */
    public $kodPakietuRecept;
    /**
     * Constructor method for KryteriaOdczytuPakietuReceptMT
     * @uses KryteriaOdczytuPakietuReceptMT::setKluczPakietuRecept()
     * @uses KryteriaOdczytuPakietuReceptMT::setKodPakietuRecept()
     * @param string $kluczPakietuRecept
     * @param string $kodPakietuRecept
     */
    public function __construct($kluczPakietuRecept = null, $kodPakietuRecept = null)
    {
        $this
            ->setKluczPakietuRecept($kluczPakietuRecept)
            ->setKodPakietuRecept($kodPakietuRecept);
    }
    /**
     * Get kluczPakietuRecept value
     * @return string|null
     */
    public function getKluczPakietuRecept()
    {
        return isset($this->kluczPakietuRecept) ? $this->kluczPakietuRecept : null;
    }
    /**
     * This method is responsible for validating the value passed to the setKluczPakietuRecept method
     * This method is willingly generated in order to preserve the one-line inline validation within the setKluczPakietuRecept 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 validateKluczPakietuReceptForChoiceConstraintsFromSetKluczPakietuRecept($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'kodPakietuRecept',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property kluczPakietuRecept can\'t be set as the property %s is already set. Only one property must be set among these properties: kluczPakietuRecept, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set kluczPakietuRecept 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 $kluczPakietuRecept
     * @return KryteriaOdczytuPakietuReceptMT
     */
    public function setKluczPakietuRecept($kluczPakietuRecept = null)
    {
        // validation for constraint: string
        if (!is_null($kluczPakietuRecept) && !is_string($kluczPakietuRecept)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kluczPakietuRecept, true), gettype($kluczPakietuRecept)), __LINE__);
        }
        // validation for constraint: choice(kluczPakietuRecept, kodPakietuRecept)
        if ('' !== ($kluczPakietuReceptChoiceErrorMessage = self::validateKluczPakietuReceptForChoiceConstraintsFromSetKluczPakietuRecept($kluczPakietuRecept))) {
            throw new \InvalidArgumentException($kluczPakietuReceptChoiceErrorMessage, __LINE__);
        }
        if (is_null($kluczPakietuRecept) || (is_array($kluczPakietuRecept) && empty($kluczPakietuRecept))) {
            unset($this->kluczPakietuRecept);
        } else {
            $this->kluczPakietuRecept = $kluczPakietuRecept;
        }
        return $this;
    }
    /**
     * Get kodPakietuRecept value
     * @return string|null
     */
    public function getKodPakietuRecept()
    {
        return isset($this->kodPakietuRecept) ? $this->kodPakietuRecept : null;
    }
    /**
     * This method is responsible for validating the value passed to the setKodPakietuRecept method
     * This method is willingly generated in order to preserve the one-line inline validation within the setKodPakietuRecept 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 validateKodPakietuReceptForChoiceConstraintsFromSetKodPakietuRecept($value)
    {
        $message = '';
        if (is_null($value)) {
            return $message;
        }
        $properties = [
            'kluczPakietuRecept',
        ];
        try {
            foreach ($properties as $property) {
                if (isset($this->{$property})) {
                    throw new \InvalidArgumentException(sprintf('The property kodPakietuRecept can\'t be set as the property %s is already set. Only one property must be set among these properties: kodPakietuRecept, %s.', $property, implode(', ', $properties)), __LINE__);
                }
            }
        } catch (\InvalidArgumentException $e) {
            $message = $e->getMessage();
        }
        return $message;
    }
    /**
     * Set kodPakietuRecept 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 $kodPakietuRecept
     * @return KryteriaOdczytuPakietuReceptMT
     */
    public function setKodPakietuRecept($kodPakietuRecept = null)
    {
        // validation for constraint: string
        if (!is_null($kodPakietuRecept) && !is_string($kodPakietuRecept)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($kodPakietuRecept, true), gettype($kodPakietuRecept)), __LINE__);
        }
        // validation for constraint: choice(kluczPakietuRecept, kodPakietuRecept)
        if ('' !== ($kodPakietuReceptChoiceErrorMessage = self::validateKodPakietuReceptForChoiceConstraintsFromSetKodPakietuRecept($kodPakietuRecept))) {
            throw new \InvalidArgumentException($kodPakietuReceptChoiceErrorMessage, __LINE__);
        }
        if (is_null($kodPakietuRecept) || (is_array($kodPakietuRecept) && empty($kodPakietuRecept))) {
            unset($this->kodPakietuRecept);
        } else {
            $this->kodPakietuRecept = $kodPakietuRecept;
        }
        return $this;
    }
}
