Files
mdb/app/services/agentsApi.ts
Bastien COIGNOUX 360522f30a recherche
2026-05-04 22:11:46 +02:00

67 lines
1.8 KiB
TypeScript

import { pb } from '@/services/pocketbase';
export type AgentImmobilierBody = {
objectif?: string;
contexte?: string;
save?: boolean;
};
export type AgentMarchandBody = {
titre?: string;
prix?: number;
surface?: number;
code_postal?: string;
ville?: string;
notes?: string;
grille_json?: string;
};
export type AgentDvfBody = {
libelle: string;
code_insee?: string;
annee?: number;
prix_m2_median?: number;
nb_ventes?: number;
detail_json?: string;
};
export type AgentVeilleBody = {
titre: string;
url?: string;
source?: string;
prix?: number;
surface?: number;
code_postal?: string;
ville?: string;
};
export type AgentRedactionBody = {
kind?: string;
bullets?: string[];
save?: boolean;
};
export async function agentImmobilier(body: AgentImmobilierBody): Promise<{ brouillon: string; courrier_id?: string }> {
return pb.send('/api/mdb/agent-immobilier', { method: 'POST', body });
}
export async function agentMarchand(body: AgentMarchandBody): Promise<{ analyse: string }> {
return pb.send('/api/mdb/agent-marchand', { method: 'POST', body });
}
export async function agentDvf(body: AgentDvfBody): Promise<{ id: string; synthese: string }> {
return pb.send('/api/mdb/agent-dvf', { method: 'POST', body });
}
export async function agentVeille(body: AgentVeilleBody): Promise<{ id: string; dedupe: boolean; message?: string }> {
return pb.send('/api/mdb/agent-veille', { method: 'POST', body });
}
export async function agentRedaction(body: AgentRedactionBody): Promise<{ texte: string; courrier_id?: string }> {
return pb.send('/api/mdb/agent-redaction', { method: 'POST', body });
}
export async function agentAlertesScan(): Promise<{ processed: number; note?: string }> {
return pb.send('/api/mdb/agent-alertes-scan', { method: 'POST', body: {} });
}