package p.studio.registry.models;

import java.util.Optional;

public record ProjectRef(String name, String version) {
    public static Optional<ProjectRef> parse(final String value) {
        final var ps = value.split("@");
        if (ps.length != 2) return Optional.empty();
        final var name = ps[0];
        final var version = ps[1];
        return Optional.of(new ProjectRef(name, version));
    }

    @Override
    public String toString() {
        return name + "@" + version;
    }
}
