<?php

namespace patest\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Crm.DuplicationCheckRuleSet StructType
 * @subpackage Structs
 */
class Crm_DuplicationCheckRuleSet extends AnyEntity
{
    /**
     * The Id
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $Id;
    /**
     * The Rules
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var \patest\StructType\RecordSetOfCrm_DuplicationCheckRule
     */
    public $Rules;
    /**
     * Constructor method for Crm.DuplicationCheckRuleSet
     * @uses Crm_DuplicationCheckRuleSet::setId()
     * @uses Crm_DuplicationCheckRuleSet::setRules()
     * @param string $id
     * @param \patest\StructType\RecordSetOfCrm_DuplicationCheckRule $rules
     */
    public function __construct($id = null, \patest\StructType\RecordSetOfCrm_DuplicationCheckRule $rules = null)
    {
        $this
            ->setId($id)
            ->setRules($rules);
    }
    /**
     * Get Id value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return string|null
     */
    public function getId()
    {
        return isset($this->Id) ? $this->Id : null;
    }
    /**
     * Set Id value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param string $id
     * @return \patest\StructType\Crm_DuplicationCheckRuleSet
     */
    public function setId($id = null)
    {
        // validation for constraint: string
        if (!is_null($id) && !is_string($id)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($id, true), gettype($id)), __LINE__);
        }
        if (is_null($id) || (is_array($id) && empty($id))) {
            unset($this->Id);
        } else {
            $this->Id = $id;
        }
        return $this;
    }
    /**
     * Get Rules value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return \patest\StructType\RecordSetOfCrm_DuplicationCheckRule|null
     */
    public function getRules()
    {
        return isset($this->Rules) ? $this->Rules : null;
    }
    /**
     * Set Rules value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param \patest\StructType\RecordSetOfCrm_DuplicationCheckRule $rules
     * @return \patest\StructType\Crm_DuplicationCheckRuleSet
     */
    public function setRules(\patest\StructType\RecordSetOfCrm_DuplicationCheckRule $rules = null)
    {
        if (is_null($rules) || (is_array($rules) && empty($rules))) {
            unset($this->Rules);
        } else {
            $this->Rules = $rules;
        }
        return $this;
    }
}
