package com.atlassian.bitbucket.repository;

import javax.annotation.Nonnull;

public class RefTestUtils {

    private RefTestUtils() {
        throw new UnsupportedOperationException("This is a utility class");
    }

    @Nonnull
    public static MinimalRef minimalBranch(@Nonnull  String name) {
        return new SimpleMinimalRef.Builder()
                .id("refs/heads/" + name)
                .displayId(name)
                .type(StandardRefType.BRANCH)
                .build();
    }

    @Nonnull
    public static MinimalRef minimalRef(@Nonnull  String name, @Nonnull  RefType type) {
        return StandardRefType.TAG.equals(type) ? minimalTag(name) : minimalBranch(name);
    }

    @Nonnull
    public static MinimalRef minimalTag(@Nonnull  String name) {
        return new SimpleMinimalRef.Builder()
                .id("refs/tags/" + name)
                .displayId(name)
                .type(StandardRefType.TAG)
                .build();
    }
}
