feat: enums, schema and models for hado core

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
nikita.hohlov
2026-09-04 06:05:34 -03:00
parent 8d01b7050d
commit 774e0bce1a
18 changed files with 447 additions and 123 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Enums;
enum EventState: string
{
case Scheduled = 'scheduled';
case Preparing = 'preparing';
case Today = 'today';
case Overdue = 'overdue';
case Done = 'done';
case Expired = 'expired';
case Withdrawn = 'withdrawn';
public function isTerminal(): bool
{
return in_array($this, [self::Done, self::Expired, self::Withdrawn], true);
}
/** Состояния, в которых ядро напоминает. */
public function isActive(): bool
{
return in_array($this, [self::Preparing, self::Today, self::Overdue], true);
}
public function countsInBadge(): bool
{
return in_array($this, [self::Today, self::Overdue], true);
}
/** @return list<string> */
public static function nonTerminalValues(): array
{
return array_values(array_map(
fn (self $s) => $s->value,
array_filter(self::cases(), fn (self $s) => ! $s->isTerminal()),
));
}
}