<?php

declare(strict_types=1);

namespace OCA\Mitgliederverwaltung\Db;

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

/**
 * Join entity linking a general material item to a category.
 *
 * Part of Issue #165 (Inventory Tracking).
 *
 * @method int|null getItemId()
 * @method void setItemId(int $itemId)
 * @method int|null getCategoryId()
 * @method void setCategoryId(int $categoryId)
 */
class InventoryItemCategory extends Entity implements JsonSerializable {

    protected int $itemId = 0;
    protected int $categoryId = 0;

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

    public function jsonSerialize(): array {
        return [
            'item_id' => $this->itemId,
            'category_id' => $this->categoryId,
        ];
    }
}
