oms-Kanban/Models/KanbanBoard.php

236 lines
3.6 KiB
PHP
Executable File

<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Kanban\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Kanban\Models;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
use Modules\Tag\Models\Tag;
/**
* Task class.
*
* @package Modules\Kanban\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class KanbanBoard implements \JsonSerializable
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
public string $name = '';
private int $status = BoardStatus::ACTIVE;
private int $order = 0;
/**
* Description.
*
* @var string
* @since 1.0.0
*/
public string $description = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
public string $descriptionRaw = '';
/**
* Tags.
*
* @var Tag[]
* @since 1.0.0
*/
private array $tags = [];
public Account $createdBy;
public \DateTimeImmutable $createdAt;
private array $columns = [];
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->createdAt = new \DateTimeImmutable('now');
$this->createdBy = new NullAccount();
}
/**
* Get id.
*
* @return int Model id
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/**
* Get the status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set the status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
$this->status = $status;
}
/**
* Get the order
*
* @return int
*
* @since 1.0.0
*/
public function getOrder() : int
{
return $this->order;
}
/**
* Set the order
*
* @param int $order Order
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(int $order) : void
{
$this->order = $order;
}
/**
* Get tags
*
* @return array
*
* @since 1.0.0
*/
public function getTags() : array
{
return $this->tags;
}
/**
* Add tag
*
* @param Tag $tag Tag
*
* @return void
*
* @since 1.0.0
*/
public function addTag(Tag $tag) : void
{
$this->tags[] = $tag;
}
/**
* Get the columns
*
* @return array
*
* @since 1.0.0
*/
public function getColumns() : array
{
return $this->columns;
}
/**
* Add a column
*
* @param mixed $column Column
*
* @return void
*
* @since 1.0.0
*/
public function addColumn($column) : void
{
$this->columns[] = $column;
}
/**
* Remove a column
*
* @param int $id Id to remove
*
* @return bool
*
* @since 1.0.0
*/
public function removeColumn(int $id) : bool
{
if (isset($this->columns[$id])) {
unset($this->columns[$id]);
return true;
}
return false;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : array
{
return [];
}
}