package dev.dinauer.maven.maven.core.model;

import org.apache.commons.lang3.Strings;

public class Version
{
    private final String raw;
    private final String base;
    private final Boolean isSnapshot;

    public Version(String raw)
    {
        this.raw = raw;
        if (Strings.CI.endsWith(raw, "-SNAPSHOT"))
        {
            this.base = Strings.CI.removeEnd(raw, "-SNAPSHOT");
            this.isSnapshot = true;
        }
        else
        {
            this.base = raw;
            this.isSnapshot = false;
        }
    }

    public String getRaw()
    {
        return raw;
    }

    public String getBase()
    {
        return base;
    }

    public Boolean isSnapshot()
    {
        return isSnapshot;
    }
}
