import os
from pathlib import Path

# HOME
MIXY_HOME = "MIXY_HOME"
DEFAULT_HOME_PATH = Path.home().joinpath(".mixy")
HOME = Path(os.getenv(MIXY_HOME, DEFAULT_HOME_PATH))
CACHE_DEFAULT_PATH = HOME.joinpath("cache")


# CONFIGURATION FILES
SETTINGS_FILE_TOML = "settings.toml"
SETTINGS_FILE_YAML = "settings.yml"


# MISC
HTTP_PREFIX = "http://"
HTTPS_PREFIX = "https://"
GIT_PREFIX = "git@"
SSH_PREFIX = "ssh://"
GIT_PROTOCOLS_PREFIXES = (
    HTTP_PREFIX,
    HTTPS_PREFIX,
    GIT_PREFIX,
    SSH_PREFIX,
)

# GITHUB
START_FORMAT = r"^"
END_FORMAT = r"$"
GIT_SUFFIX_FORMAT = r"(\.git)?"
IDENTIFIER_FORMAT = r"\w(\w|(-\w))*"
SLASH_FORMAT = r"\/"
GITHUB_HOSTNAME_FORMAT = r"https:" + SLASH_FORMAT * 2 + r"github\.com"
GITHUB_FORMATS = (
    GITHUB_HOSTNAME_FORMAT
    + IDENTIFIER_FORMAT
    + SLASH_FORMAT
    + IDENTIFIER_FORMAT
    + GIT_SUFFIX_FORMAT
    + END_FORMAT,
    IDENTIFIER_FORMAT + SLASH_FORMAT + IDENTIFIER_FORMAT,
)
