<?php

namespace VGM\WOBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * SaleType
 */
class SaleType
{
    /**
     * @var integer
     */
    private $id;
    /**
     * @var string
     */
    private $sale_type;
    /**
     * @var \DateTime
     */
    private $created_at;
    /**
     * @var \DateTime
     */
    private $updated_at;
    /**
     * @var string
     */
    private $description;
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $workorders;
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $ws_associations;
    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $invoices;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->workorders = new \Doctrine\Common\Collections\ArrayCollection();
    }
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set sale_type
     *
     * @param string $saleType
     * @return SaleType
     */
    public function setSaleType($saleType)
    {
        $this->sale_type = $saleType;

        return $this;
    }
    /**
     * Get sale_type
     *
     * @return string 
     */
    public function getSaleType()
    {
        return $this->sale_type;
    }
    /**
     * Set created_at
     *
     * @param \DateTime $createdAt
     * @return SaleType
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;

        return $this;
    }
    /**
     * Get created_at
     *
     * @return \DateTime 
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }
    /**
     * Set updated_at
     *
     * @param \DateTime $updatedAt
     * @return SaleType
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;

        return $this;
    }
    /**
     * Get updated_at
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }
    /**
     * Set description
     *
     * @param string $description
     * @return SaleType
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }
    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Add workorders
     *
     * @param \VGM\WOBundle\Entity\WorkOrder $workorders
     * @return SaleType
     */
    public function addWorkorder(\VGM\WOBundle\Entity\WorkOrder $workorders)
    {
        $this->workorders[] = $workorders;

        return $this;
    }
    /**
     * Remove workorders
     *
     * @param \VGM\WOBundle\Entity\WorkOrder $workorders
     */
    public function removeWorkorder(\VGM\WOBundle\Entity\WorkOrder $workorders)
    {
        $this->workorders->removeElement($workorders);
    }
    /**
     * Get workorders
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getWorkorders()
    {
        return $this->workorders;
    }
    /**
     * Add wsAssociation
     *
     * @param \VGM\WOBundle\Entity\WorkOrderStockAssociation $wsAssociation
     *
     * @return SaleType
     */
    public function addWsAssociation(\VGM\WOBundle\Entity\WorkOrderStockAssociation $wsAssociation)
    {
        $this->ws_associations[] = $wsAssociation;

        return $this;
    }
    /**
     * Remove wsAssociation
     *
     * @param \VGM\WOBundle\Entity\WorkOrderStockAssociation $wsAssociation
     */
    public function removeWsAssociation(\VGM\WOBundle\Entity\WorkOrderStockAssociation $wsAssociation)
    {
        $this->ws_associations->removeElement($wsAssociation);
    }
    /**
     * Get wsAssociations
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getWsAssociations()
    {
        return $this->ws_associations;
    }
    /**
     * Add invoice
     *
     * @param \VGM\WOBundle\Entity\InvoiceReference $invoice
     *
     * @return SaleType
     */
    public function addInvoice(\VGM\WOBundle\Entity\InvoiceReference $invoice)
    {
        $this->invoices[] = $invoice;

        return $this;
    }
    /**
     * Remove invoice
     *
     * @param \VGM\WOBundle\Entity\InvoiceReference $invoice
     */
    public function removeInvoice(\VGM\WOBundle\Entity\InvoiceReference $invoice)
    {
        $this->invoices->removeElement($invoice);
    }
    /**
     * Get invoices
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getInvoices()
    {
        return $this->invoices;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        $this->setCreatedAt(new \DateTime());

        return $this;
    }
    /**
     * @ORM\PrePersist
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        $this->setUpdatedAt(new \DateTime());

        return $this;
    }

    public function __toString(){
        return $this->getSaleType();
    }
}
