*/ final readonly class Stock implements AggregateRoot, HasTimestampIdentifier { private function __construct( public StockId $id, public StockAmount $stockAmount, public CampaignCode $campaignCode, public ProcessingCode $processingCode, /** @var array $stockAdjustment */ public array $stockAdjustment, public ?\DateTimeInterface $updatedAt = null, ) { } public function id(): StockId { return $this->id; } public function createdAt(): \DateTimeInterface { return $this->id->toDateTime(); } public function updatedAt(): ?\DateTimeInterface { return $this->updatedAt; } /** * @param array $stockAdjustment */ public static function hydrate( StockId $id, StockAmount $stockAmount, CampaignCode $campaignCode, ProcessingCode $processingCode, array $stockAdjustment = [], ?\DateTimeInterface $updatedAt = null, ): self { return new self( id: $id, stockAmount: $stockAmount, campaignCode: $campaignCode, processingCode: $processingCode, stockAdjustment: $stockAdjustment, updatedAt: $updatedAt, ); } }