<?php

declare(strict_types=1);

namespace OCA\Mitgliederverwaltung\Db;

use JsonSerializable;
use OCP\AppFramework\Db\Entity;

/**
 * Category entity mapping all columns from oc_mv_inventory_categories.
 *
 * Part of Issue #165 (Inventory Tracking).
 *
 * @method int|null getId()
 * @method void setId(int $id)
 * @method string getName()
 * @method void setName(string $name)
 * @method string|null getCreatedAt()
 * @method void setCreatedAt(string $createdAt)
 */
class InventoryCategory extends Entity implements JsonSerializable {

    protected int $id = 0;
    protected string $name = '';
    protected ?string $createdAt = null;

    public function __construct() {
        $this->addType('id', 'integer');
    }

    public function jsonSerialize(): array {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'created_at' => $this->createdAt,
        ];
    }
}
