package fr.emse.gitlab.saref;

import java.io.File;
import java.nio.file.FileSystems;
import java.nio.file.PathMatcher;
import java.util.regex.Pattern;

public class Constants {
	public final static String BASE = "https://saref.etsi.org/";
	public final static String BASE_DOC = BASE + "documentation/";

	public final static String LOGGER_BASE = "fr.emse.gitlab.saref.logger";
	
	public static final String REGEX_EXT = "(?<ext>core|saref4[a-z]{4})";
	public static final String REGEX_VERSION = "v(?<major>[1-9][0-9]*)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)";
	
	public static final String MASTER_BRANCH = "refs/remotes/origin/master";
	public static final String REGEX_RELEASE_BRANCH = "^refs/remotes/origin/release-" + REGEX_VERSION + "$";
	public static final String REGEX_OTHER_BRANCH = "^refs/remotes/origin/(?<name>[^/]+)$";
	public static final Pattern REGEX_RELEASE_BRANCH_PATTERN = Pattern.compile(REGEX_RELEASE_BRANCH);
	public static final Pattern REGEX_OTHER_BRANCH_PATTERN = Pattern.compile(REGEX_OTHER_BRANCH);

	public static final String REGEX_TERM_URI = "^" + BASE + REGEX_EXT + "/(?<localName>[^/]+)$";
	public static final Pattern REGEX_TERM_PATTERN = Pattern.compile(REGEX_TERM_URI);
	
	public static final String REGEX_ONTO_URI = "^" + BASE + REGEX_EXT + "/" + REGEX_VERSION + "/$";
	public static final Pattern REGEX_ONTO_PATTERN = Pattern.compile(REGEX_ONTO_URI);
	
	public static final String REGEX_ONTO_SERIES_URI = "^" + BASE + REGEX_EXT + "/$";
	public static final Pattern REGEX_ONTO_SERIES_PATTERN = Pattern.compile(REGEX_ONTO_SERIES_URI);
	
	// output 
	
	public static final String TARGET_DIR = "target";
	public static final String DATASET_DIR = TARGET_DIR + File.separator + "tdb";
	public static final String LOG_FILE_NAME = TARGET_DIR + File.separator + "output.log";
	public static final String SITE_DIR = TARGET_DIR + File.separator + "site";
	public static final String STATIC_TARGET_DIR = SITE_DIR + File.separator + "static";

	public static final String SAREF_ACCESS_TOKEN = "SAREF_ACCESS_TOKEN";
	public static final String SAREF_ACCESS_USERNAME = "SAREF_ACCESS_USERNAME";
	
	public static final String propertyFile = ".saref-repositories";

	public static final String CONFIG = BASE + "config";
	
	public static final PathMatcher ttlMatcher = FileSystems.getDefault().getPathMatcher("glob:**/*.ttl");


	public static boolean INCLUDE_MASTER = false;
	public static boolean INCLUDE_ALL = false;
	public static boolean PRODUCTION = false;
	public static boolean DEBUG_TEMPLATE = false;

}
