oms-Organization/Models/Position.php
Dennis Eichhorn 88c8a92fc4
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled
fix permissions
2025-04-02 14:15:06 +00:00

117 lines
2.0 KiB
PHP

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Organization\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.2
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Organization\Models;
/**
* Organization position class.
*
* @package Modules\Organization\Models
* @license OMS License 2.2
* @link https://jingga.app
* @since 1.0.0
*/
class Position implements \JsonSerializable
{
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
public string $name = '';
/**
* Parent
*
* @var null|Position
* @since 1.0.0
*/
public ?self $parent = null;
/**
* Department
*
* @var Department
* @since 1.0.0
*/
public Department $department;
/**
* Description.
*
* @var string
* @since 1.0.0
*/
public string $description = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
public string $descriptionRaw = '';
/**
* Status
*
* @var int
* @since 1.0.0
*/
public int $status = Status::INACTIVE;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->department = new NullDepartment();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'status' => $this->status,
'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw,
'department' => $this->department ?? new NullDepartment(),
'parent' => $this->parent,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}