<?php

declare(strict_types=1);

namespace ImovelZapAi\Publishing\Application\Data;

use Carbon\CarbonInterface;
use ImovelZapAi\Publishing\Domain\Enums\PublicationTargetStatus;

final readonly class PropertyPublicationChannelData
{
    public function __construct(
        public string $publisherId,
        public string $publisherSlug,
        public string $publisherName,
        public ?string $publisherDescription,
        public PublicationTargetStatus $status,
        public string $statusLabel,
        public string $statusTone,
        public ?string $externalUrl,
        public ?string $lastError,
        public ?CarbonInterface $lastSyncedAt,
        public bool $canPublish,
        public bool $canSync,
    ) {}

    public function lastSyncedAtLabel(): ?string
    {
        return $this->lastSyncedAt?->timezone(config('app.timezone'))->format('d/m/Y H:i');
    }
}
