/**
 * System Error Catalog
 *
 * Defines all system related errors.
 */

import { ErrorCategory, ErrorEntry } from './types';

export const SYSTEM_ERRORS: Record<string, ErrorEntry> = {
	FILE_UPLOAD_FAILED: {
		code: 'FILE_UPLOAD_FAILED',
		httpStatus: 500,
		category: ErrorCategory.SYSTEM,
		severity: 'high',
		logToSentry: true,
		message: {
			vi: 'Tải lên file thất bại',
			en: 'File upload failed',
		},
	},
	INTERNAL_SERVER_ERROR: {
		code: 'INTERNAL_SERVER_ERROR',
		httpStatus: 500,
		category: ErrorCategory.SYSTEM,
		severity: 'critical',
		logToSentry: true,
		userVisible: false,
		message: {
			vi: 'Lỗi máy chủ',
			en: 'Internal server error',
		},
	},
	CONFIG_ERROR: {
		code: 'CONFIG_ERROR',
		httpStatus: 500,
		category: ErrorCategory.SYSTEM,
		severity: 'critical',
		logToSentry: true,
		userVisible: false,
		message: {
			vi: 'Lỗi cấu hình',
			en: 'Configuration error',
		},
	},
	SSE_ERROR: {
		code: 'SSE_ERROR',
		httpStatus: 500,
		category: ErrorCategory.SYSTEM,
		severity: 'critical',
		logToSentry: true,
		userVisible: false,
		message: {
			vi: 'Lỗi kết nối SSE',
			en: 'Server-Sent Events connection error',
		},
	},
	TOO_MANY_REQUESTS: {
		code: 'TOO_MANY_REQUESTS',
		httpStatus: 429,
		category: ErrorCategory.SYSTEM,
		severity: 'medium',
		message: {
			vi: 'Quá nhiều yêu cầu, vui lòng thử lại sau',
			en: 'Too many requests, please try again later',
		},
	},
};
