package com.ruoyi.api.controller.clock;

import com.ruoyi.api.controller.common.AbstractApiController;
import com.ruoyi.clock.domain.vo.AdVo;
import com.ruoyi.clock.service.IAdService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;

/**
 * 广告Controller
 *
 * @author pengc
 * @date 2026-03-04
 */
@Validated
@Api(value = "广告控制器", tags = {"广告管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/clock/ad")
public class ApiAdController extends AbstractApiController {

    private final IAdService iAdService;

    /**
     * 获取广告详细信息
     */
    @ApiOperation("获取广告详细信息")
    @GetMapping("/info/{locationCode}")
    public R<AdVo> info(@ApiParam("主键")
                                                  @NotNull(message = "主键不能为空")
                                                  @PathVariable("locationCode") String locationCode) {
        return R.ok(iAdService.queryByLocationCode(locationCode));
    }

}
