<?php

namespace patest\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for KeyValuePairOfguidPricingTreehpjoQDea StructType
 * Meta information extracted from the WSDL
 * - nillable: true
 * - type: tns:KeyValuePairOfguidPricingTreehpjoQDea
 * @subpackage Structs
 */
class KeyValuePairOfguidPricingTreehpjoQDea extends AbstractStructBase
{
    /**
     * The key
     * Meta information extracted from the WSDL
     * - base: xs:string
     * - nillable: true
     * - pattern: [\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}
     * - type: tns:guid
     * @var string
     */
    public $key;
    /**
     * The value
     * Meta information extracted from the WSDL
     * - nillable: true
     * @var \patest\StructType\PricingTree
     */
    public $value;
    /**
     * Constructor method for KeyValuePairOfguidPricingTreehpjoQDea
     * @uses KeyValuePairOfguidPricingTreehpjoQDea::setKey()
     * @uses KeyValuePairOfguidPricingTreehpjoQDea::setValue()
     * @param string $key
     * @param \patest\StructType\PricingTree $value
     */
    public function __construct($key = null, \patest\StructType\PricingTree $value = null)
    {
        $this
            ->setKey($key)
            ->setValue($value);
    }
    /**
     * Get key value
     * @return string|null
     */
    public function getKey()
    {
        return $this->key;
    }
    /**
     * Set key value
     * @param string $key
     * @return \patest\StructType\KeyValuePairOfguidPricingTreehpjoQDea
     */
    public function setKey($key = null)
    {
        // validation for constraint: string
        if (!is_null($key) && !is_string($key)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($key, true), gettype($key)), __LINE__);
        }
        // validation for constraint: pattern([\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12})
        if (!is_null($key) && !preg_match('/[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}/', $key)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a literal that is among the set of character sequences denoted by the regular expression [\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}', var_export($key, true)), __LINE__);
        }
        $this->key = $key;
        return $this;
    }
    /**
     * Get value value
     * @return \patest\StructType\PricingTree|null
     */
    public function getValue()
    {
        return $this->value;
    }
    /**
     * Set value value
     * @param \patest\StructType\PricingTree $value
     * @return \patest\StructType\KeyValuePairOfguidPricingTreehpjoQDea
     */
    public function setValue(\patest\StructType\PricingTree $value = null)
    {
        $this->value = $value;
        return $this;
    }
}
