<?php

declare(strict_types=1);

namespace OCA\Mitgliederverwaltung\Db;

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

/**
 * @method string getName()
 * @method void setName(string $name)
 * @method int getSortOrder()
 * @method void setSortOrder(int $sortOrder)
 * @method int|null getAgeRangeMin()
 * @method void setAgeRangeMin(?int $ageRangeMin)
 * @method int|null getAgeRangeMax()
 * @method void setAgeRangeMax(?int $ageRangeMax)
 * @method string|null getColor()
 * @method void setColor(?string $color)
 */
class Stufe extends Entity implements JsonSerializable {

    protected string $name = '';
    protected int $sortOrder = 0;
    protected ?int $ageRangeMin = null;
    protected ?int $ageRangeMax = null;
    protected ?string $color = null;

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

    public function jsonSerialize(): array {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'sortOrder' => $this->sortOrder,
            'ageRangeMin' => $this->ageRangeMin,
            'ageRangeMax' => $this->ageRangeMax,
            'color' => $this->color,
        ];
    }
}
