$attributes * @param list $flags */ public function __construct( private readonly string $name, private readonly ?string $delimiter, private readonly array $attributes, private readonly int $messages = 0, private readonly int $unread = 0, private readonly ?int $state = null, private readonly int $recent = 0, private readonly array $flags = [], private readonly bool $readOnly = true, ) {} public function fromStatus(StatusResult $status): self { return new self( $this->name, $this->delimiter, $this->attributes, $status->messages() ?? $this->messages, $status->unseen() ?? $this->unread, $status->state() ?? $this->state, $this->recent, $this->flags, $this->readOnly, ); } public function name(): string { return $this->name; } public function delimiter(): ?string { return $this->delimiter; } /** * @return list */ public function attributes(): array { return $this->attributes; } public function state(): ?int { return $this->state; } public function messages(): int { return $this->messages; } public function unread(): int { return $this->unread; } public function read(): int { return max(0, $this->messages - $this->unread); } public function recent(): int { return $this->recent; } /** * @return list */ public function flags(): array { return $this->flags; } public function readOnly(): bool { return $this->readOnly; } public function isSelectable(): bool { return !in_array('\\NOSELECT', $this->attributes, true); } }