package com.jeesharp.business.marketing.tenant.controller;

import com.jeesharp.business.modules.marketing.api.MarketingMobileApi;
import com.jeesharp.business.modules.marketing.tenant.vo.MarketingTenantLandingVO;
import com.jeesharp.framework.pojo.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 扫码落地页免登录接口（路径 {@code /mobile/noAuth/marketing/tenant/**}）。
 *
 * @author jeesharp
 * @since 2026-06-25
 */
@RestController
@Tag(name = "移动端-扫码落地（免登录）", description = "解析小程序 scene，返回店铺落地信息")
@AllArgsConstructor
public class MarketingTenantNoAuthMobileController {

    private final MarketingMobileApi marketingMobileApi;

    @Operation(summary = "解析 scene 获取店铺落地信息")
    @GetMapping("${jeesharp.web.mobilePath}/noAuth/marketing/tenant/landing")
    public AjaxResult<MarketingTenantLandingVO> landing(
            @Parameter(description = "小程序码 scene 参数", required = true)
            @RequestParam("scene") String scene) {
        return AjaxResult.okData(marketingMobileApi.resolveLandingByScene(scene));
    }
}
