import { Request, Response, NextFunction } from 'express';
import * as residenceLeadsService from '../services/residenceLeads.service';
import { sendSuccess, sendError } from '../utils/apiResponse';

export const listGlobal = async (req: Request, res: Response) => {
  try {
    const filters = {
      status: req.query.status,
      project_id: req.query.project_id,
      limit: req.query.limit,
      offset: req.query.offset
    };
    const leads = await residenceLeadsService.getAllLeadsGlobal(filters);
    return sendSuccess(res, 200, 'Liste globale des leads', leads);
  } catch (error: any) {
    return sendError(res, 400, error.message);
  }
};
