<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Description StructType
 * @package Dg
 * @subpackage Structs
 */
class DgDescription extends DgFormattedTextTextType
{
    /**
     * The _
     * @var \dgsoft\StructType\DgFormattedTextTextType
     */
    public $_;
    /**
     * The Caption
     * @var string
     */
    public $Caption;
    /**
     * The ListItem
     * @var int
     */
    public $ListItem;
    /**
     * Constructor method for Description
     * @uses DgDescription::set_()
     * @uses DgDescription::setCaption()
     * @uses DgDescription::setListItem()
     * @param \dgsoft\StructType\DgFormattedTextTextType $_
     * @param string $caption
     * @param int $listItem
     */
    public function __construct(\dgsoft\StructType\DgFormattedTextTextType $_ = null, $caption = null, $listItem = null)
    {
        $this
            ->set_($_)
            ->setCaption($caption)
            ->setListItem($listItem);
    }
    /**
     * Get _ value
     * @return \dgsoft\StructType\DgFormattedTextTextType|null
     */
    public function get_()
    {
        return $this->_;
    }
    /**
     * Set _ value
     * @param \dgsoft\StructType\DgFormattedTextTextType $_
     * @return \dgsoft\StructType\DgDescription
     */
    public function set_(\dgsoft\StructType\DgFormattedTextTextType $_ = null)
    {
        $this->_ = $_;
        return $this;
    }
    /**
     * Get Caption value
     * @return string|null
     */
    public function getCaption()
    {
        return $this->Caption;
    }
    /**
     * Set Caption value
     * @param string $caption
     * @return \dgsoft\StructType\DgDescription
     */
    public function setCaption($caption = null)
    {
        // validation for constraint: string
        if (!is_null($caption) && !is_string($caption)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($caption)), __LINE__);
        }
        $this->Caption = $caption;
        return $this;
    }
    /**
     * Get ListItem value
     * @return int|null
     */
    public function getListItem()
    {
        return $this->ListItem;
    }
    /**
     * Set ListItem value
     * @param int $listItem
     * @return \dgsoft\StructType\DgDescription
     */
    public function setListItem($listItem = null)
    {
        // validation for constraint: int
        if (!is_null($listItem) && !is_numeric($listItem)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a numeric value, "%s" given', gettype($listItem)), __LINE__);
        }
        $this->ListItem = $listItem;
        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 \dgsoft\StructType\DgDescription
     */
    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__;
    }
}
