<?php

if ( ! defined( 'ABSPATH' ) ) exit;

require_once "DigitalSignage4_Entity.php";

class DigitalSignage4_AutomatisationEntity extends DigitalSignage4_Entity
{
    private $id = null;
    private $created = 0; // Nombre de vidéo créer via cette entité

    private $name = null;

    /**
     * @var boolean
     */
    private $active = null;

    private $hookCreation = null;
    private $hookSell = null;
    private $hookDay = null;
    private $hookWeek = null;

    private $nbJours = 0;
    private $nbProduit = 0;

    private $gabarit = null;

    /**
     * @var DigitalSignage4_PlaylistEntity
     */
    private $playlist = null;


    /**
     * @var array
     */
    private $categorie = null;

    private $priceMin = null;
    private $priceMax = null;


    public function getHookDay()
    {
        return $this->hookDay;
    }

    /**
     * @param  $hookDay
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setHookDay($hookDay)
    {
        $this->hookDay = $hookDay;
        return $this;
    }


    public function getGabarit()
    {
        return $this->gabarit;
    }

    /**
     * @param  $gabarit
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setGabarit($gabarit)
    {
        $this->gabarit = $gabarit;
        return $this;
    }

    /**
     * @return int
     */
    public function getNbJours()
    {
        return $this->nbJours;
    }

    /**
     * @param int $nbJours
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setNbJours($nbJours)
    {
        $this->nbJours = $nbJours;
        return $this;
    }

    /**
     * @return int
     */
    public function getNbProduit()
    {
        return $this->nbProduit;
    }

    /**
     * @param int $nbProduit
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setNbProduit($nbProduit)
    {
        $this->nbProduit = $nbProduit;
        return $this;
    }




    public function getHookWeek()
    {
        return $this->hookWeek;
    }

    /**
     * @param  $hookWeek
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setHookWeek($hookWeek)
    {
        $this->hookWeek = $hookWeek;
        return $this;
    }



    public function getId()
    {
        return $this->id;
    }


    public function getName()
    {
        return $this->name;
    }

    /**
     * @param  $name
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }



    /**
     * @param  $id
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }


    public function getCreated()
    {
        return $this->created;
    }

    /**
     * @param int $created
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setCreated($created)
    {
        $this->created = $created;
        return $this;
    }

    /**
     * @return bool
     */
    public function isActive()
    {
        return $this->active;
    }

    /**
     * @param bool $active
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setActive($active)
    {
        $this->active = $this->is_true($active);
        return $this;
    }


    public function getHookCreation()
    {
        return $this->hookCreation;
    }

    /**
     * @param  $hookCreation
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setHookCreation($hookCreation)
    {
        $this->hookCreation = $hookCreation;
        return $this;
    }


    public function getHookSell()
    {
        return $this->hookSell;
    }

    /**
     * @param  $hookSell
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setHookSell($hookSell)
    {
        $this->hookSell = $hookSell;
        return $this;
    }

    /**
     * @return array
     */
    public function getCategorie()
    {
        return $this->categorie;
    }

    /**
     * @param array $categorie
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setCategorie($categorie)
    {
        $this->categorie = $categorie;
        return $this;
    }

    public function addCategorie($categorie)
    {
        $this->categorie[] = $categorie;
        return $this;
    }

    public function removeCategorie($categorie)
    {
        $this->categorie = array_diff($this->categorie, array($categorie));
        return $this;
    }


    public function getPriceMin()
    {
        return $this->priceMin;
    }

    /**
     * @param  $priceMin
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setPriceMin($priceMin)
    {
        $this->priceMin = $priceMin;
        return $this;
    }


    public function getPriceMax()
    {
        return $this->priceMax;
    }

    /**
     * @param  $priceMax
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setPriceMax($priceMax)
    {
        $this->priceMax = $priceMax;
        return $this;
    }

    /**
     * @return DigitalSignage4_PlaylistEntity
     */
    public function getPlaylist()
    {
        return $this->playlist;
    }

    /**
     * @param DigitalSignage4_PlaylistEntity $playlist
     * @return DigitalSignage4_AutomatisationEntity
     */
    public function setPlaylist($playlist)
    {
        $this->playlist = $playlist;
        return $this;
    }

    public function is_true($val, $return_null=false)
    {
        $boolval = (is_string($val) ? filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool) $val);
        return ($boolval===null && !$return_null ? false : $boolval);
    }
}
