<?php

namespace App\Base\Dto;

use Symfony\Component\Serializer\Attribute\SerializedPath;

class AppVersionDto
{
    #[SerializedPath('[1]')]
    public string|int $major = 0;
    #[SerializedPath('[2]')]
    public string|int $minor = 0;
    #[SerializedPath('[3]')]
    public string|int $patch = 0;
    #[SerializedPath('[4]')]
    public ?string $pre = null;
    #[SerializedPath('[5]')]
    public ?string $build = null;

    public function __toString()
    {
        return 'v' . $this->major . '.' . $this->minor . '.' . $this->patch . ($this->pre ? '-' . $this->pre : '') . ($this->build ? '+' . $this->build : '');
    }
}
