// services/vcs-provider.interface.js
// Provider-agnostic interface (shape) for VCS adapters.

class VcsProviderInterface {
  // Parse a repository URL and return { owner, repo, branch }
  parseRepoUrl(url) {
    throw new Error('parseRepoUrl not implemented');
  }

  // Access check for repository
  async checkRepositoryAccess(owner, repo) {
    throw new Error('checkRepositoryAccess not implemented');
  }

  // Fetch repository metadata
  async fetchRepositoryMetadata(owner, repo) {
    throw new Error('fetchRepositoryMetadata not implemented');
  }

  // Analyze codebase (lightweight tree analysis)
  async analyzeCodebase(owner, repo, branch) {
    throw new Error('analyzeCodebase not implemented');
  }

  // Ensure a webhook exists for this repository
  async ensureRepositoryWebhook(owner, repo, callbackUrl) {
    throw new Error('ensureRepositoryWebhook not implemented');
  }

  // Sync using git; index to storage/DB via file storage service
  async syncRepositoryWithGit(owner, repo, branch, repositoryId) {
    throw new Error('syncRepositoryWithGit not implemented');
  }

  // Fallback: API download + storage
  async downloadRepositoryWithStorage(owner, repo, branch, repositoryId) {
    throw new Error('downloadRepositoryWithStorage not implemented');
  }

  // Try git first then API
  async syncRepositoryWithFallback(owner, repo, branch, repositoryId) {
    throw new Error('syncRepositoryWithFallback not implemented');
  }

  // Get diff and change lists
  async getRepositoryDiff(owner, repo, branch, fromSha, toSha) {
    throw new Error('getRepositoryDiff not implemented');
  }

  async getRepositoryChangesSince(owner, repo, branch, sinceSha) {
    throw new Error('getRepositoryChangesSince not implemented');
  }

  // Cleanup local storage/DB artifacts
  async cleanupRepositoryStorage(repositoryId) {
    throw new Error('cleanupRepositoryStorage not implemented');
  }
}

module.exports = VcsProviderInterface;


