export interface Medicine {
  id: string;
  nregistro: string;
  name: string;
  active_ingredient: string;
  dosage: string;
  form: string;
  formSimplified: string;
  laboratory: string;
  prescription: string;
  commercialized: boolean;
  generic: boolean;
  photos: string[];
  docs: { tipo: number; url: string; urlHtml?: string; secc: boolean; fecha: number }[];
  // Optional pharmacy-specific fields (only present in pharmacy_medicines joins)
  precio?: number | null;
  stock?: number;
}

export interface Pharmacy {
  id: number;
  name: string;
  address: string;
  phone: string;
  latitude: number;
  longitude: number;
  opening_hours?: string;
}

export interface PharmacyMedicine {
  id: number;
  pharmacy_id?: number;
  medicine_nregistro?: string;
  medicine_name?: string;
  name?: string;
  address?: string;
  phone?: string;
  latitude?: number;
  longitude?: number;
  opening_hours?: string;
  price?: number | null;
  stock?: number;
  pharmacy?: Pharmacy;
}

export interface User {
  id: number;
  username: string;
  is_admin: boolean;
}

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

export interface SearchResponse {
  medicines: Medicine[];
  total: number;
}

export interface ApiResponse<T> {
  data: T;
  success: boolean;
  error?: string;
}