Files
fewo-stommer/app/Channels/Events/Provenance.php
T

33 lines
984 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Channels\Events;
use App\Models\Channel;
use Carbon\CarbonImmutable;
/**
* Where a channel event came from (docs/Prozessarchitektur/Architektur/02 §8.2): channel, transport and whether its
* origin is technically authenticated (a signed webhook, an API call with credentials). It says nothing about whether a
* business action really happened – that is evidence, which only the landlord or a checked receipt provides (M3).
*/
final readonly class Provenance
{
public const AUTHENTICATED = 'authenticated';
public const UNAUTHENTICATED = 'unauthenticated';
public function __construct(
public Channel $channel,
public string $transport,
public string $authenticity,
public ?string $externalReference,
public string $evidenceRef,
public CarbonImmutable $receivedAt,
) {}
public function isAuthenticated(): bool
{
return $this->authenticity === self::AUTHENTICATED;
}
}