<?php declare(strict_types=1);

namespace Newland\Toubiz\Sync\Neos\Tests\Factory;

use Newland\Toubiz\Sync\Neos\Domain\Model\Medium;

/**
 * @method Medium create(array $properties = [])
 */
class MediaFactory extends AbstractFactory
{

    public function make(array $properties = [])
    {
        $media = new Medium();

        $media->setType($properties['type'] ?? 'image');
        $media->setSourceUri($properties['sourceUri'] ?? $this->faker->imageUrl());
        $media->setPreviewUri($properties['previewUri'] ?? $this->faker->imageUrl());
        $media->setOriginalId($properties['originalId'] ?? $this->faker->uuid);
        $media->setTitle($properties['title'] ?? $this->faker->words(3, true));
        $media->setCopyright($properties['copyright'] ?? $this->faker->paragraph);
        $media->setFocusPointX($properties['focusPoint']['x'] ?? random_int(0, 100));
        $media->setFocusPointY($properties['focusPoint']['y'] ?? random_int(0, 100));

        return $media;
    }
}
