// @ts-nocheck
import { JwtSecretUpdateError, JwtSecretUpdateProgress } from '@supabase/shared-types/out/events'

import { JWTSigningKey } from '@/data/jwt-signing-keys/jwt-signing-keys-query'

export const statusLabels: Record<JWTSigningKey['status'], string> = {
  in_use: 'Current key',
  standby: 'Standby key',
  previously_used: 'Previous key',
  revoked: 'Revoked',
}

export const statusColors: Record<JWTSigningKey['status'], string> = {
  standby: 'bg-surface-300 text-foreground border border-foreground-muted',
  in_use: 'bg-brand-200 text-brand-600 border-brand-500',
  previously_used: 'bg-warning-200 text-warning-600 border-warning-500',
  revoked: 'bg-destructive-200 text-destructive-600 border-destructive-500',
}

export const JWT_SECRET_UPDATE_ERROR_MESSAGES = {
  [JwtSecretUpdateError.APIServicesConfigurationUpdateFailed]:
    'failed to update configuration for API services',
  [JwtSecretUpdateError.APIServicesRestartFailed]: 'failed to restart API services',
  [JwtSecretUpdateError.DatabaseAdminAPIConfigurationUpdateFailed]:
    'failed to update configuration for database admin API',
  [JwtSecretUpdateError.PostgreSQLRestartFailed]: 'failed to restart PostgreSQL service',
  [JwtSecretUpdateError.BrivenAPIKeyUpdateFailed]: 'failed to update Briven API key',
  [JwtSecretUpdateError.APIGatewayUpdateFailed]: 'failed to update API Gateway',
}

export const JWT_SECRET_UPDATE_PROGRESS_MESSAGES = {
  [JwtSecretUpdateProgress.RestartedAPIServices]: 'restarted API services',
  [JwtSecretUpdateProgress.RestartedPostgreSQL]: 'restarted PostgreSQL service',
  [JwtSecretUpdateProgress.Started]: 'started updating',
  [JwtSecretUpdateProgress.UpdatedAPIServicesConfiguration]:
    'updated configuration for API services',
  [JwtSecretUpdateProgress.UpdatedDatabaseAdminAPIConfiguration]:
    'updated configuration for database admin API',
  [JwtSecretUpdateProgress.UpdatedAPIGatewayConfiguration]: 'updated configuration for API Gateway',
}
