export type MessageType =
  | 'event_summary'
  | 'birthday_list'
  | 'dienstjubilaeen'
  | 'fahrzeug_status'
  | 'fahrzeug_event'
  | 'bestellungen';

export type TriggerMode = 'day_of_week' | 'days_before_month_start' | 'event';
export type WindowMode = 'rolling' | 'calendar_month';

export interface ScheduledMessageRule {
  id: string;
  name: string;
  message_type: MessageType;
  trigger_mode: TriggerMode;
  day_of_week: number | null;
  send_time: string | null;
  days_before_month_start: number | null;
  window_mode: WindowMode | null;
  window_days: number | null;
  target_room_token: string;
  target_room_name: string | null;
  template: string;
  extra_config: Record<string, unknown> | null;
  subscribable: boolean;
  allowed_groups: string[];
  last_sent_at: string | null;
  active: boolean;
  created_at: string;
  subscriber_count?: number;
  is_subscribed?: boolean;
}

export interface NextcloudRoom {
  token: string;
  displayName: string;
  type: number;
}

export interface ScheduledMessagesListResponse {
  data: ScheduledMessageRule[];
}

export interface ScheduledMessageDetailResponse {
  data: ScheduledMessageRule;
}

export interface RoomsResponse {
  configured: boolean;
  data?: NextcloudRoom[];
  error?: string;
}

export interface OneTimeMessage {
  id: string;
  message: string;
  target_room_token: string;
  target_room_name: string | null;
  send_at: string;
  created_by: string | null;
  created_at: string;
}
