// src/shared/contracts/logger.ts
// Shared contracts for dynamic log management system

import { z } from 'zod';

/**
 * Log channels/categories for different parts of the system
 */
export const LogChannelEnum = z.enum([
  'SYSTEM',
  'HTTP',
  'DB',
  'SOCKET',
  'AUTH',
  'CRON',
]);

export type LogChannel = z.infer<typeof LogChannelEnum>;

/**
 * Log levels for controlling verbosity
 * Levels hierarchy: debug < info < warn < error < silent
 */
export const LogLevelEnum = z.enum([
  'debug',
  'info',
  'warn',
  'error',
  'silent',
]);

export type LogLevel = z.infer<typeof LogLevelEnum>;

/**
 * Log configuration mapping channels to their current levels
 */
export const LogConfigSchema = z.record(LogChannelEnum, LogLevelEnum);

export type LogConfig = z.infer<typeof LogConfigSchema>;

/**
 * Request schema for updating log configuration
 */
export const UpdateLogConfigSchema = z.object({
  channel: LogChannelEnum,
  level: LogLevelEnum,
});

export type UpdateLogConfigRequest = z.infer<typeof UpdateLogConfigSchema>;

/**
 * Response schema for getting log configuration
 */
export const GetLogConfigResponseSchema = LogConfigSchema;

export type GetLogConfigResponse = z.infer<typeof GetLogConfigResponseSchema>;
