export interface User {
  id: number;
  username: string;
  email: string;
  created_at: string;
  updated_at: string;
}

export interface Counter {
  id: number;
  user_id?: number;
  name: string;
  description: string;
  created_at: string;
  updated_at: string;
}

export interface CounterEntry {
  id: number;
  counter_id: number;
  value: number;
  date: string;
  created_at: string;
}

export interface CounterWithStats {
  id: number | string; // Allow both number (authenticated) and string (anonymous) IDs
  name: string;
  description: string;
  created_at: string;
  updated_at: string;
  total_value: number;
  today_value: number;
  week_value: number;
  month_value: number;
  entry_count: number;
}

export interface AnonymousCounter {
  id: string;
  name: string;
  description: string;
  total_value: number;
  entries: Record<string, number>; // date -> count
  created_at: string;
  updated_at: string;
}

export interface AuthResponse {
  token: string;
  user: User;
}

export interface RegisterRequest {
  username: string;
  email: string;
  password: string;
}

export interface LoginRequest {
  username: string;
  password: string;
}

export interface CreateCounterRequest {
  name: string;
  description: string;
}

export interface UpdateCounterRequest {
  name: string;
  description: string;
}

export interface IncrementRequest {
  value: number;
}

export interface DailyStat {
  date: string;
  total: number;
}

export interface CounterStats {
  daily_stats: DailyStat[];
}
