package com.atlassian.bitbucket.mesh.repository;

import javax.annotation.Nonnull;
import java.nio.file.Path;

import static java.util.Objects.requireNonNull;

/**
 * A {@link Repository} implementation which is simply a wrapper for the repository's path, used when Mesh is running
 * as a sidecar.
 */
public interface PathRepository extends Repository {

    @Nonnull
    static String formatId(@Nonnull Path path) {
        return formatId(requireNonNull(path, "path").toAbsolutePath().toString());
    }

    @Nonnull
    static String formatId(@Nonnull String path) {
        return "path:" + requireNonNull(path, "path");
    }
}
