export const APPROVAL_CONFIG = {
  // Emoji to use for approvals (default: white_check_mark)
  APPROVAL_EMOJI: "white_check_mark",

  // Emoji to use for rejections (default: x)
  REJECTION_EMOJI: "x",

  // Organizations and repositories that require approval before optimization
  // Format: "owner" for entire organization, or "owner/repo" for specific repositories
  APPROVAL_REQUIRED_REPOS: {
    roboflow: true,
    rungalileo: true,
    dashtoon: true,
    Dashverse: true,
    pydantic: true,
    "Skyvern-AI": true,
    // "aseembits93/my-best-repo": true,
    stackai: true,
    "Unstructured-IO": true,
    // Example: "organization/specific-repo": true,
  } as Record<string, boolean>,

  // Organizations and repositories with quality monitoring enabled
  // Format: "owner" for entire organization, or "owner/repo" for specific repositories
  QUALITY_MONITORING_REPOS: {
    "langflow-ai": true,
    // Add repositories here that need quality monitoring
    // Example: "organization": true,
    // Example: "organization/specific-repo": true,
    // "aseembits93/my-best-repo": true,
  } as Record<string, boolean>,
} as const

export function requiresApproval(owner: string, repo?: string): boolean {
  // Check for specific repository first (owner/repo)
  if (repo) {
    const fullRepoName = `${owner}/${repo}`
    if (APPROVAL_CONFIG.APPROVAL_REQUIRED_REPOS[fullRepoName] === true) {
      return true
    }
  }

  // Check for organization-wide setting
  return APPROVAL_CONFIG.APPROVAL_REQUIRED_REPOS[owner] === true
}

export function hasQualityMonitoring(owner: string, repo?: string): boolean {
  // Check for specific repository first (owner/repo)
  if (repo) {
    const fullRepoName = `${owner}/${repo}`
    if (APPROVAL_CONFIG.QUALITY_MONITORING_REPOS[fullRepoName] === true) {
      return true
    }
  }

  // Check for organization-wide setting
  return APPROVAL_CONFIG.QUALITY_MONITORING_REPOS[owner] === true
}

export function getApprovalEmoji(): string {
  return APPROVAL_CONFIG.APPROVAL_EMOJI
}

export function getRejectionEmoji(): string {
  return APPROVAL_CONFIG.REJECTION_EMOJI
}
