// src/types.ts - Tipos compartidos para MCP Spreadsheets
export interface SyncConfig {
databaseUrl: string;
spreadsheetId: string;
sheetName: string;
credentials: GoogleCredentials;
cronSchedule: string;
syncMode: 'db_to_sheet' | 'sheet_to_db' | 'bidirectional';
batchLimit: number;
columnMapping: ColumnMapping[];
primaryKey: string;
}
export interface GoogleCredentials {
client_email: string;
private_key: string;
}
export interface ColumnMapping {
dbColumn: string;
sheetColumn: string;
transform?: (value: any) => any;
}
export interface SyncResult {
success: boolean;
startTime: Date;
endTime: Date;
duration: number;
rowsProcessed: number;
rowsAdded: number;
rowsUpdated: number;
rowsDeleted: number;
errors: string[];
}
export interface ReservaRecord {
id: number;
bookingid: string;
arrival: string | null;
departure: string | null;
propertyid: string | null;
roomid: number | null;
guestfirstname: string | null;
guestlastname: string | null;
guestemail: string | null;
guestphone: string | null;
guestmobile: string | null;
status: string | null;
channel: string | null;
numadult: string | null;
numchild: string | null;
price: string | null;
deposit: string | null;
tax: string | null;
commission: string | null;
notes: string | null;
comments: string | null;
bookingtime: string | null;
modifiedtime: string | null;
invoiceitems: string | null;
infoitems: string | null;
clasificaciondescarga: string | null;
created_at: Date | null;
updated_at: Date | null;
}
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
// Mapeo de columnas por defecto
export const DEFAULT_COLUMN_MAPPING: ColumnMapping[] = [
{ dbColumn: 'bookingid', sheetColumn: 'ID Reserva' },
{ dbColumn: 'arrival', sheetColumn: 'Llegada' },
{ dbColumn: 'departure', sheetColumn: 'Salida' },
{ dbColumn: 'guestfirstname', sheetColumn: 'Nombre' },
{ dbColumn: 'guestlastname', sheetColumn: 'Apellido' },
{ dbColumn: 'guestemail', sheetColumn: 'Email' },
{ dbColumn: 'guestphone', sheetColumn: 'Telefono' },
{ dbColumn: 'guestmobile', sheetColumn: 'Movil' },
{ dbColumn: 'status', sheetColumn: 'Estado' },
{ dbColumn: 'channel', sheetColumn: 'Canal' },
{ dbColumn: 'propertyid', sheetColumn: 'Propiedad' },
{ dbColumn: 'numadult', sheetColumn: 'Adultos' },
{ dbColumn: 'numchild', sheetColumn: 'Ninos' },
{ dbColumn: 'price', sheetColumn: 'Precio' },
{ dbColumn: 'deposit', sheetColumn: 'Deposito' },
{ dbColumn: 'tax', sheetColumn: 'Impuesto' },
{ dbColumn: 'commission', sheetColumn: 'Comision' },
{ dbColumn: 'notes', sheetColumn: 'Notas' },
{ dbColumn: 'bookingtime', sheetColumn: 'Fecha Reserva' },
{ dbColumn: 'modifiedtime', sheetColumn: 'Ultima Modificacion' },
{ dbColumn: 'clasificaciondescarga', sheetColumn: 'Clasificacion' },
{ dbColumn: '_totalPagado', sheetColumn: 'Total Pagado' },
];