<?php

declare(strict_types=1);

namespace Dalten\RuianToUir\Tests\Unit\Converter\Field;

use Dalten\RuianToUir\Converter\Field\GeometryField;
use Dalten\RuianToUir\Converter\Field\Point;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(Point::class)]
#[CoversClass(GeometryField::class)]
final class PointTest extends TestCase
{
    public function testBuildsWktAndToStringFromLatLngString(): void
    {
        $p = new Point('50.123456 14.654321');
        $this->assertSame('Point(50.123456 14.654321)', $p->getWKT());
        $this->assertSame('Point(50.123456 14.654321)', (string) $p);
    }

    public function testBuildsWktForMultipleCoordinatesInOrder(): void
    {
        $g = new GeometryField('LineString', [
            ['lat' => 1, 'lng' => 2],
            ['lat' => 3, 'lng' => 4],
        ]);

        // Not used directly in production, but verifies WKT building and joining
        $this->assertSame('LineString(1 2, 3 4)', $g->getWKT());
    }
}
