/**
 * Database Error Catalog
 *
 * Defines all database related errors.
 */

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

export const DATABASE_ERRORS: Record<string, ErrorEntry> = {
	DATABASE_ERROR: {
		code: 'DATABASE_ERROR',
		httpStatus: 500,
		category: ErrorCategory.DATABASE,
		severity: 'high',
		logToSentry: true,
		message: {
			vi: 'Lỗi cơ sở dữ liệu',
			en: 'Database error',
		},
	},
	FOREIGN_KEY_CONSTRAINT: {
		code: 'FOREIGN_KEY_CONSTRAINT',
		httpStatus: 409,
		category: ErrorCategory.DATABASE,
		severity: 'high',
		message: {
			vi: 'Lỗi ràng buộc khóa ngoại',
			en: 'Foreign key constraint error',
		},
	},
	UNIQUE_CONSTRAINT: {
		code: 'UNIQUE_CONSTRAINT',
		httpStatus: 409,
		category: ErrorCategory.DATABASE,
		severity: 'high',
		message: {
			vi: 'Giá trị phải duy nhất',
			en: 'Value must be unique',
		},
	},
};
