package com.common.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.common.entity.BlockResponse;
import com.common.service.BlacklistApiService;


@RestController
@RequestMapping("/api/blacklist")
public class BlacklistController {

    @Autowired
    private BlacklistApiService blacklistApiService;

    @PostMapping("/add")
    public BlockResponse addIp(@RequestParam String ip,
                                   @RequestParam(defaultValue = "300") String age,
                                   @RequestParam(defaultValue = "1") String enable) {
        return blacklistApiService.addToBlacklist(ip, age, enable);
    }
}