import { Request, Response } from "express";
import { WapService } from "../services/wap.service";
import { PaginateWapServerParams } from "src/models/WapServers.Model";

const wapService = new WapService();

export class WapController {
    public getServers = async (req: Request, res: Response): Promise<void> => {
        try {
            let data: PaginateWapServerParams = req.body as PaginateWapServerParams;
            const servers = await wapService.getWapServers(data);
            res.json(servers);
        } catch (error) {
            console.error("Error fetching wap servers:", error);
            res.status(500).json({ success: false, message: "Internal Server Error" });
        }
    };
}
