projectId; } /** * @return array */ public function deliveryMetadata(): array { return [ 'project_key' => $this->projectKey, 'ticket_key' => $this->ticketKey, ]; } /** * @return array */ public function discordTemplateVariables(): array { return [ '$url' => $this->ticketUrl, '$ticket_key' => $this->ticketKey, '$ticket_title' => $this->ticketTitle, '$project_name' => $this->projectName, '$status_from' => $this->fromStatusLabel ?? '', '$status_to' => $this->toStatusLabel, '$actor_name' => $this->actorName ?? '', '$assignee_from' => $this->fromAssigneeName ?? '', '$assignee_to' => $this->toAssigneeName ?? '', ]; } /** * @return array{ * event_type: string, * project: array{id: int, key: string, name: string}, * ticket: array{id: int, key: string, title: string}, * actor: array{id: int, name: string}|null, * assignee: array{ * from: array{id: int, name: string}|null, * to: array{id: int, name: string}|null * }, * from: array{id: int, label: string}|null, * to: array{id: int, label: string}, * ticket_url: string, * occurred_at: string * } */ public function toArray(): array { return [ 'event_type' => NotificationEventType::TicketAssigneeChanged->value, 'project' => [ 'id' => $this->projectId, 'key' => $this->projectKey, 'name' => $this->projectName, ], 'ticket' => [ 'id' => $this->ticketId, 'key' => $this->ticketKey, 'title' => $this->ticketTitle, ], 'actor' => $this->actorId === null || $this->actorName === null ? null : [ 'id' => $this->actorId, 'name' => $this->actorName, ], 'assignee' => [ 'from' => $this->fromAssigneeId === null || $this->fromAssigneeName === null ? null : [ 'id' => $this->fromAssigneeId, 'name' => $this->fromAssigneeName, ], 'to' => $this->toAssigneeId === null || $this->toAssigneeName === null ? null : [ 'id' => $this->toAssigneeId, 'name' => $this->toAssigneeName, ], ], 'from' => $this->fromStatusId === null || $this->fromStatusLabel === null ? null : [ 'id' => $this->fromStatusId, 'label' => $this->fromStatusLabel, ], 'to' => [ 'id' => $this->toStatusId, 'label' => $this->toStatusLabel, ], 'ticket_url' => $this->ticketUrl, 'occurred_at' => $this->occurredAt->toISOString(), ]; } }