<?php

namespace Lc\CaracoleBundle\Model\Config;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
 * @ORM\MappedSuperclass
 */
abstract class UnitModel extends AbstractLightEntity implements UnitInterface
{

    const UNIT_PERCENT = 'percent';
    const UNIT_AMOUNT = 'amount';


    public function getUnitAmountChoices(): array
    {
        return [
                self::UNIT_PERCENT,
                self::UNIT_AMOUNT,
        ];
    }

    /**
     * @ORM\Column(type="string", length=32)
     */
    protected $unit;

    /**
     * @ORM\Column(type="string", length=32)
     */
    protected $wording;

    /**
     * @ORM\Column(type="string", length=32)
     */
    protected $wordingUnit;

    /**
     * @ORM\Column(type="string", length=32)
     */
    protected $wordingShort;

    /**
     * @ORM\Column(type="integer")
     */
    protected $coefficient;

    /**
     * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Config\UnitInterface")
     * @ORM\JoinColumn(nullable=true)
     */
    protected $unitReference;

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

    public function getUnit(): ?string
    {
        return $this->unit;
    }

    public function setUnit(string $unit): self
    {
        $this->unit = $unit;

        return $this;
    }

    public function getWording(): ?string
    {
        return $this->wording;
    }

    public function setWording(string $wording): self
    {
        $this->wording = $wording;

        return $this;
    }

    public function getWordingUnit(): ?string
    {
        return $this->wordingUnit;
    }

    public function setWordingUnit(string $wordingUnit): self
    {
        $this->wordingUnit = $wordingUnit;

        return $this;
    }

    public function getWordingShort(): ?string
    {
        return $this->wordingShort;
    }

    public function setWordingShort(string $wordingShort): self
    {
        $this->wordingShort = $wordingShort;

        return $this;
    }

    public function getCoefficient(): ?int
    {
        return $this->coefficient;
    }

    public function setCoefficient(int $coefficient): self
    {
        $this->coefficient = $coefficient;

        return $this;
    }

    public function getUnitReference(): ?self
    {
        return $this->unitReference;
    }

    public function setUnitReference(?UnitInterface $unitReference): self
    {
        $this->unitReference = $unitReference;

        return $this;
    }
}