/**
 * Configuration de l'application TowerControl (version standalone)
 */

export interface AppConfig {
  app: {
    name: string;
    version: string;
  };
  ui: {
    theme: 'light' | 'dark' | 'system';
    itemsPerPage: number;
  };
  features: {
    enableDragAndDrop: boolean;
    enableNotifications: boolean;
    autoSave: boolean;
  };
  integrations: {
    jira: {
      enabled: boolean;
      baseUrl?: string;
      email?: string;
      apiToken?: string;
    };
  };
}

// Configuration par défaut
const defaultConfig: AppConfig = {
  app: {
    name: 'TowerControl',
    version: '2.0.0',
  },
  ui: {
    theme:
      (process.env.NEXT_PUBLIC_THEME as 'light' | 'dark' | 'system') ||
      'system',
    itemsPerPage: parseInt(process.env.NEXT_PUBLIC_ITEMS_PER_PAGE || '50'),
  },
  features: {
    enableDragAndDrop: process.env.NEXT_PUBLIC_ENABLE_DRAG_DROP !== 'false',
    enableNotifications:
      process.env.NEXT_PUBLIC_ENABLE_NOTIFICATIONS === 'true',
    autoSave: process.env.NEXT_PUBLIC_AUTO_SAVE !== 'false',
  },
  integrations: {
    jira: {
      enabled: Boolean(
        process.env.JIRA_BASE_URL &&
          process.env.JIRA_EMAIL &&
          process.env.JIRA_API_TOKEN
      ),
      baseUrl: process.env.JIRA_BASE_URL,
      email: process.env.JIRA_EMAIL,
      apiToken: process.env.JIRA_API_TOKEN,
    },
  },
};

/**
 * Récupère la configuration de l'application
 */
export function getConfig(): AppConfig {
  return defaultConfig;
}

/**
 * Configuration pour le développement/debug
 */
export const DEBUG_CONFIG = {
  isDevelopment: process.env.NODE_ENV === 'development',
  verboseLogging: process.env.VERBOSE_LOGGING === 'true',
  enableDevTools: process.env.NODE_ENV === 'development',
};
