<?php

declare(strict_types=1);

namespace Plugin\tnt_stabila_shop\src\DomainObjects;

use DateTime;
use Plugin\tnt_stabila_shop\src\Enums\PageType;
use Plugin\tnt_stabila_shop\src\Helper\ShopRuntime;

class PerformanceDTO
{
    public DateTime $createDateTime;

    public function __construct(
        public float $totalExecutionInSeconds,
        public PageType $pageType,
    ) {
        try {
            $this->createDateTime = new DateTime('now', ShopRuntime::timezone());
        } catch (\DateException) {
            $this->createDateTime = new DateTime();
        }
    }
}
