interface StaffTimeEntry { id: string started_at: string stopped_at?: string | null duration_minutes?: number | null type: string description?: string | null created_at?: string } export function useStaffTime() { const { $api } = useNuxtApp() async function list(params?: { user_id?: string }) { const query = new URLSearchParams() if (params?.user_id) query.append("user_id", params.user_id) return await $api(`/api/staff/time${query.toString() ? `?${query}` : ''}`, { method: 'GET' }) } async function start(description?: string) { return await $api('/api/staff/time', { method: 'POST', body: { started_at: new Date().toISOString(), type: 'work', description, }, }) } async function stop(id: string) { return await $api(`/api/staff/time/${id}/stop`, { method: 'PUT', body: { stopped_at: new Date().toISOString() }, }) } async function submit(id: string) { return await $api(`/api/staff/time/${id}`, { method: 'PUT', body: { state: 'submitted' }, }) } async function approve(id: string) { return await $api(`/api/staff/time/${id}`, { method: 'PUT', body: { state: 'approved' }, }) } async function get(id: string) { return await $api(`/api/staff/time/${id}`, { method: 'GET' }) } async function create(data: Record) { return await $api('/api/staff/time', { method: 'POST', body: data }) } async function update(id: string, data: Record) { return await $api(`/api/staff/time/${id}`, { method: 'PUT', body: data }) } return { list, start, stop,submit,approve, get, create, update } }