<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for ProductionTimetablePermissions StructType
 * Meta informations extracted from the WSDL
 * - documentation: Participant's permissions to use the service.
 * @subpackage Structs
 */
class ProductionTimetablePermissions extends PermissionsStructure
{
    /**
     * The ProductionTimetablePermission
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * - ref: ProductionTimetablePermission
     * @var \StructType\ConnectionServicePermissionStructure[]
     */
    public $ProductionTimetablePermission;
    /**
     * Constructor method for ProductionTimetablePermissions
     * @uses ProductionTimetablePermissions::setProductionTimetablePermission()
     * @param \StructType\ConnectionServicePermissionStructure[] $productionTimetablePermission
     */
    public function __construct(array $productionTimetablePermission = array())
    {
        $this
            ->setProductionTimetablePermission($productionTimetablePermission);
    }
    /**
     * Get ProductionTimetablePermission value
     * @return \StructType\ConnectionServicePermissionStructure[]|null
     */
    public function getProductionTimetablePermission()
    {
        return $this->ProductionTimetablePermission;
    }
    /**
     * Set ProductionTimetablePermission value
     * @throws \InvalidArgumentException
     * @param \StructType\ConnectionServicePermissionStructure[] $productionTimetablePermission
     * @return \StructType\ProductionTimetablePermissions
     */
    public function setProductionTimetablePermission(array $productionTimetablePermission = array())
    {
        foreach ($productionTimetablePermission as $productionTimetablePermissionsProductionTimetablePermissionItem) {
            // validation for constraint: itemType
            if (!$productionTimetablePermissionsProductionTimetablePermissionItem instanceof \StructType\ConnectionServicePermissionStructure) {
                throw new \InvalidArgumentException(sprintf('The ProductionTimetablePermission property can only contain items of \StructType\ConnectionServicePermissionStructure, "%s" given', is_object($productionTimetablePermissionsProductionTimetablePermissionItem) ? get_class($productionTimetablePermissionsProductionTimetablePermissionItem) : gettype($productionTimetablePermissionsProductionTimetablePermissionItem)), __LINE__);
            }
        }
        $this->ProductionTimetablePermission = $productionTimetablePermission;
        return $this;
    }
    /**
     * Add item to ProductionTimetablePermission value
     * @throws \InvalidArgumentException
     * @param \StructType\ConnectionServicePermissionStructure $item
     * @return \StructType\ProductionTimetablePermissions
     */
    public function addToProductionTimetablePermission(\StructType\ConnectionServicePermissionStructure $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\ConnectionServicePermissionStructure) {
            throw new \InvalidArgumentException(sprintf('The ProductionTimetablePermission property can only contain items of \StructType\ConnectionServicePermissionStructure, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->ProductionTimetablePermission[] = $item;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \StructType\ProductionTimetablePermissions
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
