package shop.alien.store.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.store.service.LifeMessageNotDisturbService;

/**
 * <p>
 * 消息免打扰 前端控制器
 * </p>
 *
 * @author ssk
 * @since 2025-07-11
 */
@Api(tags = {"三期-消息免打扰"})
@Slf4j
@CrossOrigin
@RequiredArgsConstructor
@RestController
@RequestMapping("/lifeMessageNotDisturb")
public class LifeMessageNotDisturbController {

    private final LifeMessageNotDisturbService lifeMessageNotDisturbService;

    @ApiOperation("免打扰")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "receiverId", value = "当前登录人phoneId", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "disturbId", value = "秒打扰人phoneId", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "1-免打扰  2-取消免打扰", dataType = "Integer", paramType = "query")})
    @GetMapping("/notDisturb")
    public R<Boolean> notDisturb(@RequestParam String receiverId,
                                 @RequestParam String disturbId,
                                 @RequestParam int type) {
        log.info("LifeMessageNotDisturbController.notDisturb?receiverId={}, disturbId={}, type={}", receiverId, disturbId, type);
        if (lifeMessageNotDisturbService.notDisturb(receiverId, disturbId, type)) return R.success("操作成功");
        return R.fail("操作失败");
    }

}
