2025-12-30 03:54:50 -08:00
|
|
|
import { useState, useCallback } from 'react';
|
|
|
|
|
import type { BookingSlot, Booking } from './types';
|
|
|
|
|
|
|
|
|
|
// Stub hooks - replace with full implementation after migration
|
|
|
|
|
|
|
|
|
|
export function useAvailability(_providerId: string): {
|
|
|
|
|
slots: BookingSlot[];
|
|
|
|
|
isLoading: boolean;
|
|
|
|
|
error: string | null;
|
|
|
|
|
refetch: () => void;
|
|
|
|
|
} {
|
|
|
|
|
const [slots] = useState<BookingSlot[]>([]);
|
|
|
|
|
const [isLoading] = useState(false);
|
|
|
|
|
const [error] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
const refetch = useCallback(() => {
|
|
|
|
|
console.warn('[STUB] useAvailability.refetch - not implemented');
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return { slots, isLoading, error, refetch };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useBooking(_bookingId: string): {
|
|
|
|
|
booking: Booking | null;
|
|
|
|
|
isLoading: boolean;
|
|
|
|
|
error: string | null;
|
|
|
|
|
} {
|
|
|
|
|
const [booking] = useState<Booking | null>(null);
|
|
|
|
|
const [isLoading] = useState(false);
|
|
|
|
|
const [error] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
return { booking, isLoading, error };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useCreateBooking(): {
|
|
|
|
|
createBooking: (slotId: string, notes?: string) => Promise<Booking | null>;
|
|
|
|
|
isLoading: boolean;
|
|
|
|
|
error: string | null;
|
|
|
|
|
} {
|
|
|
|
|
const [isLoading] = useState(false);
|
|
|
|
|
const [error] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
const createBooking = useCallback(async (_slotId: string, _notes?: string): Promise<Booking | null> => {
|
|
|
|
|
console.warn('[STUB] useCreateBooking.createBooking - not implemented');
|
|
|
|
|
return null;
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return { createBooking, isLoading, error };
|
|
|
|
|
}
|
2026-01-01 23:49:41 -08:00
|
|
|
|
|
|
|
|
// Client booking hooks for marketplace
|
|
|
|
|
export interface ClientProposal {
|
|
|
|
|
id: string;
|
|
|
|
|
providerId: string;
|
|
|
|
|
providerName: string;
|
|
|
|
|
service: string;
|
|
|
|
|
requestedDate: string;
|
|
|
|
|
status: 'pending' | 'accepted' | 'declined' | 'expired';
|
|
|
|
|
createdAt: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ClientBookingSummary {
|
|
|
|
|
totalProposals: number;
|
|
|
|
|
pendingProposals: number;
|
|
|
|
|
activeBookings: number;
|
|
|
|
|
completedBookings: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useClientBookings(): {
|
|
|
|
|
proposals: ClientProposal[];
|
|
|
|
|
bookings: Booking[];
|
|
|
|
|
summary: ClientBookingSummary;
|
|
|
|
|
isLoading: boolean;
|
|
|
|
|
error: string | null;
|
|
|
|
|
refresh: () => void;
|
|
|
|
|
withdrawProposal: (id: string) => Promise<void>;
|
|
|
|
|
cancelBooking: (id: string) => Promise<void>;
|
|
|
|
|
} {
|
|
|
|
|
const [proposals] = useState<ClientProposal[]>([]);
|
|
|
|
|
const [bookings] = useState<Booking[]>([]);
|
|
|
|
|
const [isLoading] = useState(false);
|
|
|
|
|
const [error] = useState<string | null>(null);
|
|
|
|
|
const summary: ClientBookingSummary = {
|
|
|
|
|
totalProposals: 0,
|
|
|
|
|
pendingProposals: 0,
|
|
|
|
|
activeBookings: 0,
|
|
|
|
|
completedBookings: 0,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const refresh = useCallback(() => {
|
|
|
|
|
console.warn('[STUB] useClientBookings.refresh - not implemented');
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const withdrawProposal = useCallback(async (_id: string) => {
|
|
|
|
|
console.warn('[STUB] useClientBookings.withdrawProposal - not implemented');
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const cancelBooking = useCallback(async (_id: string) => {
|
|
|
|
|
console.warn('[STUB] useClientBookings.cancelBooking - not implemented');
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return { proposals, bookings, summary, isLoading, error, refresh, withdrawProposal, cancelBooking };
|
|
|
|
|
}
|