<?php

namespace NPS\Entity;

use Doctrine\ORM\Mapping as ORM;
use NPS\Entity\UserEntity;
use DateTime;

/**
 * Knowledge base entity
 * @author Lukas Korinek
 * @ORM\Entity
 * @ORM\Table(name="`knowledge_base`")
 */
class KnowledgeBaseEntity implements IEntity
{
    use TIdProperty;
    use TCreate;

    const STATUS_DEV = 0;
    const STATUS_TESTING = 1;
    const STATUS_PUBLIC = 2;
    const STATUS_DEMO = 3;

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

    /**
     * @ORM\Column(type="datetime", name="date_created", length=250, nullable=false)
     * @var DateTime
     */
    public $dateCreated;

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

    /**
     * @ORM\Column(type="array", length=100, name="languages", nullable=false)
     * @var array
     */
    public $languages;

    /**
     * @ORM\Column(type="array", length=2048, name="name", nullable=false)
     * @var array
     */
    public $name;

    /**
     * @ORM\Column(type="array", length=2048, name="description", nullable=false)
     * @var array
     */
    public $description;

    /**
     * @ORM\Column(type="string", name="path", length=400)
     * @var string
     */
    public $path;

    public function __construct()
    {
        $this->dateCreated = new \DateTime();
        $this->status = self::STATUS_DEV;

        $this->name = [];
        $this->description = [];
        $this->languages = [];
    }

    public function __clone()
    {
        $this->id = null;
        $this->status = self::STATUS_DEV;
        $this->dateCreated = new DateTime();
        $this->path = null;
    }
}

