/**
 * The ReposConfiguration object contains information about your local repositories,
 * like their name and location on your local filesystem. Add repositories to this
 * configuration object to make a static site for them.
 * 
 * You will also need to set the {@link ReposConfiguration.baseUrl} to the URL of your
 * live website.
 * @example
 * const config: ReposConfiguration = {
 *   baseUrl: "https://repos.tuckerm.us",
 *   repos: {
 *     "My Git Project": {
 *       defaultBranch: 'main',
 *       branchesToPull: ['main', 'develop']
 *     },
 *   },
 * }
 */
export type ReposConfiguration = {
  repos: {
    /** An object containing the configuration for your repositories.
    * Each key in this object is a repository name, and the value has several
    * config options for that repository. The required config options describe
    * the path to the repository and which branches should be pulled. See the specific
    * definition of {@link GitConfig} for more details
    * about what goes in these configuration objects.
    */
    [repoName: string]: GitConfig
  },
  /**
  * The root URL where this website will be. E.g.: https://blog.example.com/repos.
  * This URL will be used when a clone or pull command is being shown on your site.
  * @example baseUrl: "https://repos.tuckerm.us"
  */
  baseUrl: string,
  /**
  * The path to put the generated site in. All generated files will be put in this
  * directory, repos for cloning will be put in this directory, and it will be
  * added to the end of all URLs used by the default virtual template.
  * @example path: "/repos"
  */
  path?: string,
  useDefaultTemplate?: boolean,
  defaultTemplateConfiguration?: {
    allRepositoriesPageTitle?: string,
  },
}

export type GitConfig = {
  /* The absolute path to the repository.
  * @example location: "/home/alice/projects/git_repo"
  */
  location: string,
  description?: string,
  defaultBranch: string,
  branchesToPull: Array<string | {pattern: string, max?: number, compareTo?: string, description?: string}>,
  tags?: Array<string | {glob: string, max: number}>,
  languageExtensions?: {
    [fileExtension: string]: string
  },
  buildSteps?: {
    command: string,
    copyFrom: string,
    copyTo: string,
  }[],
  defaultTemplateConfiguration?: {
    homepageButtons: Array<{
      url: string,
      text: string,
      newTab?: boolean,
    }>
  },
}
