/**
 * Test helpers for creating mock Configuration objects
 */

import { Configuration } from '../../src/configurations/CalendarConfig';
import { ICalendarConfig } from '../../src/configurations/ICalendarConfig';
import { IGridSettings } from '../../src/configurations/GridSettings';
import { IDateViewSettings } from '../../src/configurations/DateViewSettings';
import { ITimeFormatConfig } from '../../src/configurations/TimeFormatConfig';

/**
 * Create a minimal test configuration with default values
 */
export function createTestConfig(overrides: Partial<{
  timezone: string;
  hourHeight: number;
  snapInterval: number;
}> = {}): Configuration {
  const gridSettings: IGridSettings = {
    hourHeight: overrides.hourHeight ?? 60,
    gridStartTime: '00:00',
    gridEndTime: '24:00',
    workStartTime: '08:00',
    workEndTime: '17:00',
    snapInterval: overrides.snapInterval ?? 15,
    gridStartThresholdMinutes: 15
  };

  const dateViewSettings: IDateViewSettings = {
    periodType: 'week',
    firstDayOfWeek: 1
  };

  const timeFormatConfig: ITimeFormatConfig = {
    timezone: overrides.timezone ?? 'Europe/Copenhagen',
    locale: 'da-DK',
    showSeconds: false
  };

  const calendarConfig: ICalendarConfig = {
    gridSettings,
    dateViewSettings,
    timeFormatConfig,
    currentWorkWeek: 'standard',
    currentView: 'week',
    selectedDate: new Date().toISOString()
  };

  return new Configuration(
    calendarConfig,
    gridSettings,
    dateViewSettings,
    timeFormatConfig,
    'standard',
    'week',
    new Date()
  );
}
