<?php

declare(strict_types=1);

namespace App\Data\Images;

final readonly class SquareThumbnailResultData
{
    /**
     * @param array<string, mixed> $meta
     */
    public function __construct(
        public string $destinationPath,
        public CropBoxData $cropBox,
        public string $cropMode,
        public int $sourceWidth,
        public int $sourceHeight,
        public int $targetWidth,
        public int $targetHeight,
        public int $outputWidth,
        public int $outputHeight,
        public ?string $detectionReason = null,
        public array $meta = [],
    ) {
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(): array
    {
        return [
            'destination_path' => $this->destinationPath,
            'crop_mode' => $this->cropMode,
            'source_width' => $this->sourceWidth,
            'source_height' => $this->sourceHeight,
            'target_width' => $this->targetWidth,
            'target_height' => $this->targetHeight,
            'output_width' => $this->outputWidth,
            'output_height' => $this->outputHeight,
            'detection_reason' => $this->detectionReason,
            'crop_box' => $this->cropBox->toArray(),
            'meta' => $this->meta,
        ];
    }
}