2026-02-09 23:02:34 -05:00

65 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\MailCalendarSync\Db;
use OCP\AppFramework\Db\Entity;
/**
* @method string getUserId()
* @method void setUserId(string $userId)
* @method int getEnabled()
* @method void setEnabled(int $enabled)
* @method int|null getMailAccountId()
* @method void setMailAccountId(?int $mailAccountId)
* @method string|null getCalendarUri()
* @method void setCalendarUri(?string $calendarUri)
* @method int getAutoAccept()
* @method void setAutoAccept(int $autoAccept)
* @method int getSyncInterval()
* @method void setSyncInterval(int $syncInterval)
* @method string|null getCreatedAt()
* @method void setCreatedAt(?string $createdAt)
* @method string|null getUpdatedAt()
* @method void setUpdatedAt(?string $updatedAt)
*/
class Config extends Entity {
protected string $userId = '';
protected int $enabled = 0;
protected ?int $mailAccountId = null;
protected ?string $calendarUri = null;
protected int $autoAccept = 0;
protected int $syncInterval = 600;
protected ?string $createdAt = null;
protected ?string $updatedAt = null;
public function __construct() {
$this->addType('enabled', 'integer');
$this->addType('mailAccountId', 'integer');
$this->addType('autoAccept', 'integer');
$this->addType('syncInterval', 'integer');
}
public function isEnabled(): bool {
return $this->getEnabled() === 1;
}
public function isAutoAccept(): bool {
return $this->getAutoAccept() === 1;
}
public function toArray(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
'enabled' => $this->isEnabled(),
'mailAccountId' => $this->getMailAccountId(),
'calendarUri' => $this->getCalendarUri(),
'autoAccept' => $this->isAutoAccept(),
'syncInterval' => $this->getSyncInterval(),
];
}
}