<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Suscriber
 *
 * @ORM\Table(name="suscriber")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SuscriberRepository")
 */
class Suscriber
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="shortName", type="string", length=11, unique=true, nullable=true)
     */
    private $shortName;

    /**
     * @var string
     *
     * @ORM\Column(name="longName", type="string", length=255, unique=true, nullable=true)
     */
    private $longName;

    /**
     * @var string
     *
     * @ORM\Column(name="about", type="string", length=255, nullable=true)
     */
    private $about;


    /**
     * @var int
     *
     * @ORM\Column(name="balance", type="integer", nullable=false)
     */
    private $balance;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="createdAt", type="datetime")
     */
    private $createdAt;

    /**
     * @ORM\OneToMany(targetEntity="\UserBundle\Entity\User", mappedBy="suscriber")
     */
    private $account;


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

    /**
     * Set shortName
     *
     * @param string $shortName
     *
     * @return Suscriber
     */
    public function setShortName($shortName)
    {
        $this->shortName = $shortName;

        return $this;
    }

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

    /**
     * Set longName
     *
     * @param string $longName
     *
     * @return Suscriber
     */
    public function setLongName($longName)
    {
        $this->longName = $longName;

        return $this;
    }

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

    /**
     * Set about
     *
     * @param string $about
     *
     * @return Suscriber
     */
    public function setAbout($about)
    {
        $this->about = $about;

        return $this;
    }

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

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return Suscriber
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

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

    /**
     * Set balance
     *
     * @param integer $balance
     *
     * @return Suscriber
     */
    public function setBalance($balance)
    {
        $this->balance = $balance;

        return $this;
    }
    
    /**
     * Set balance
     *
     * @param integer $balance
     *
     * @return Suscriber
     */
    public function billBalance($billAmount)
    {
        $this->balance = $this->balance - $billAmount;

        return $this;
    }

    /**
     * Get balance
     *
     * @return integer
     */
    public function getBalance()
    {
        return $this->balance;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->account = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add account
     *
     * @param \UserBundle\Entity\User $account
     *
     * @return Suscriber
     */
    public function addAccount(\UserBundle\Entity\User $account)
    {
        $this->account[] = $account;

        return $this;
    }

    /**
     * Remove account
     *
     * @param \UserBundle\Entity\User $account
     */
    public function removeAccount(\UserBundle\Entity\User $account)
    {
        $this->account->removeElement($account);
    }

    /**
     * Get account
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAccount()
    {
        return $this->account;
    }

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