<?php

namespace VGM\WOBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * LaborLoop
 */
class LaborLoop
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var \DateTime
     */
    private $date;

    /**
     * @var \DateTime
     */
    private $started_at;

    /**
     * @var \DateTime
     */
    private $finished_at;

    /**
     * @var float
     */
    private $total_time;

    /**
     * @var float
     */
    private $hour_cost;

    /**
     * @var boolean
     */
    private $lunch;

    /**
     * @var float
     */
    private $p_overtime;

    /**
     * @var float
     */
    private $c_overtime;

    /**
     * @var float
     */
    private $overtime_cost;

    /**
     * @var boolean
     */
    private $week_closed;

    /**
     * @var \VGM\WOBundle\Entity\NoticeLoop
     */
    private $notice;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set started_at
     *
     * @param \DateTime $startedAt
     * @return LaborLoop
     */
    public function setStartedAt($startedAt)
    {
        $this->started_at = $startedAt;

        return $this;
    }

    /**
     * Get started_at
     *
     * @return \DateTime 
     */
    public function getStartedAt()
    {
        return $this->started_at;
    }

    /**
     * Set finished_at
     *
     * @param \DateTime $finishedAt
     * @return LaborLoop
     */
    public function setFinishedAt($finishedAt)
    {
        $this->finished_at = $finishedAt;
        //$this->setTotalTime($this->getTimeInHours());

        return $this;
    }

    /**
     * Get finished_at
     *
     * @return \DateTime 
     */
    public function getFinishedAt()
    {
        return $this->finished_at;
    }

    /**
     * Set date
     *
     * @param \DateTime $date
     * @return LaborLoop
     */
    public function setDate($date)
    {
        $this->date = $date;

        return $this;
    }

    /**
     * Get date
     *
     * @return \DateTime 
     */
    public function getDate()
    {
        return $this->date;
    }

    /**
     * Set total_time
     *
     * @param float $totalTime
     * @return LaborLoop
     */
    public function setTotalTime($totalTime)
    {
        $this->total_time = $totalTime;

        return $this;
    }

    /**
     * Get total_time
     *
     * @return float
     */
    public function getTotalTime()
    {
        return $this->total_time;
    }

    /**
     * Set hour_cost
     *
     * @param float $hourCost
     * @return LaborLoop
     */
    public function setHourCost($hourCost)
    {
        $this->hour_cost = $hourCost;
        $this->setOvertimeCost($hourCost * 1.5);

        return $this;
    }

    /**
     * Get hour_cost
     *
     * @return float 
     */
    public function getHourCost()
    {
        return $this->hour_cost;
    }

    /**
     * Set lunch
     *
     * @param boolean $lunch
     * @return LaborLoop
     */
    public function setLunch($lunch)
    {
        $this->lunch = $lunch;

        return $this;
    }

    /**
     * Get lunch
     *
     * @return boolean 
     */
    public function getLunch()
    {
        return $this->lunch;
    }

    /**
     * Set p_overtime
     *
     * @param float $pOvertime
     * @return LaborLoop
     */
    public function setPOvertime($pOvertime)
    {
        $this->p_overtime = $pOvertime;

        return $this;
    }

    /**
     * Get p_overtime
     *
     * @return float 
     */
    public function getPOvertime()
    {
        return $this->p_overtime;
    }

    /**
     * Set c_overtime
     *
     * @param float $cOvertime
     * @return LaborLoop
     */
    public function setCOvertime($cOvertime)
    {
        $this->c_overtime = $cOvertime;

        return $this;
    }

    /**
     * Get c_overtime
     *
     * @return float 
     */
    public function getCOvertime()
    {
        return $this->c_overtime;
    }

    /**
     * Set overtime_cost
     *
     * @param float $overtimeCost
     * @return LaborLoop
     */
    public function setOvertimeCost($overtimeCost)
    {
        $this->overtime_cost = $overtimeCost;

        return $this;
    }

    /**
     * Get overtime_cost
     *
     * @return float 
     */
    public function getOvertimeCost()
    {
        return $this->overtime_cost;
    }

    /**
     * Set week_closed
     *
     * @param boolean $weekClosed
     * @return LaborLoop
     */
    public function setWeekClosed($weekClosed)
    {
        $this->week_closed = $weekClosed;

        return $this;
    }

    /**
     * Get week_closed
     *
     * @return boolean 
     */
    public function getWeekClosed()
    {
        return $this->week_closed;
    }

    /**
     * Set notice
     *
     * @param \VGM\WOBundle\Entity\NoticeLoop $notice
     * @return LaborLoop
     */
    public function setNotice(\VGM\WOBundle\Entity\NoticeLoop $notice = null)
    {
        $this->notice = $notice;

        return $this;
    }

    /**
     * Get notice
     *
     * @return \VGM\WOBundle\Entity\NoticeLoop
     */
    public function getNotice()
    {
        return $this->notice;
    }

    /**
     * @ORM\PrePersist
     */
    public function setDefaultsValue()
    {
        if($this->week_closed == null)
            $this->week_closed =  false;

        if($this->c_overtime == null)
            $this->c_overtime = 0;

        if($this->p_overtime == null)
            $this->p_overtime = 0;

        return $this;
    }
    /**
     * @var string
     */
    private $assigned_stock_no;

    /**
     * @var string
     */
    private $area;

    /**
     * @var string
     */
    private $description;

    /**
     * @var \VGM\WOBundle\Entity\WorkOrder
     */
    private $workorder;

    /**
     * @var \VGM\WOBundle\Entity\Worker
     */
    private $worker;

    /**
     * @var \VGM\WOBundle\Entity\NDepartment
     */
    private $department;


    /**
     * Set assignedStockNo
     *
     * @param string $assignedStockNo
     *
     * @return LaborLoop
     */
    public function setAssignedStockNo($assignedStockNo)
    {
        $this->assigned_stock_no = $assignedStockNo;

        return $this;
    }

    /**
     * Get assignedStockNo
     *
     * @return string
     */
    public function getAssignedStockNo()
    {
        return $this->assigned_stock_no;
    }

    /**
     * Set area
     *
     * @param string $area
     *
     * @return LaborLoop
     */
    public function setArea($area)
    {
        $this->area = $area;

        return $this;
    }

    /**
     * Get area
     *
     * @return string
     */
    public function getArea()
    {
        return $this->area;
    }

    /**
     * Set description
     *
     * @param string $description
     *
     * @return LaborLoop
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set workorder
     *
     * @param \VGM\WOBundle\Entity\WorkOrder $workorder
     *
     * @return LaborLoop
     */
    public function setWorkorder(\VGM\WOBundle\Entity\WorkOrder $workorder = null)
    {
        $this->workorder = $workorder;

        return $this;
    }

    /**
     * Get workorder
     *
     * @return \VGM\WOBundle\Entity\WorkOrder
     */
    public function getWorkorder()
    {
        return $this->workorder;
    }

    /**
     * Set worker
     *
     * @param \VGM\WOBundle\Entity\Worker $worker
     *
     * @return LaborLoop
     */
    public function setWorker(\VGM\WOBundle\Entity\Worker $worker = null)
    {
        $this->worker = $worker;

        return $this;
    }

    /**
     * Get worker
     *
     * @return \VGM\WOBundle\Entity\Worker
     */
    public function getWorker()
    {
        return $this->worker;
    }

    /**
     * Set department
     *
     * @param \VGM\WOBundle\Entity\NDepartment $department
     *
     * @return LaborLoop
     */
    public function setDepartment(\VGM\WOBundle\Entity\NDepartment $department = null)
    {
        $this->department = $department;

        return $this;
    }

    /**
     * Get department
     *
     * @return \VGM\WOBundle\Entity\NDepartment
     */
    public function getDepartment()
    {
        return $this->department;
    }
}
