package com.jeesharp.business.modules.marketing.application.api;

import com.jeesharp.business.modules.coupon.vo.CouponDemoVO;
import com.jeesharp.business.modules.coupon.vo.MemberCouponInfoVO;
import com.jeesharp.business.modules.coupon.vo.MemberCouponListVO;
import com.jeesharp.business.modules.marketing.api.MarketingMobileApi;
import com.jeesharp.business.modules.marketing.coupon.application.MarketingCouponApplicationService;
import com.jeesharp.business.modules.marketing.coupon.application.MarketingCouponVerifyApplicationService;
import com.jeesharp.business.modules.marketing.coupon.dto.MarketingCouponReceiveDTO;
import com.jeesharp.business.modules.marketing.coupon.dto.MarketingCouponTenantQueryDTO;
import com.jeesharp.business.modules.marketing.coupon.dto.MarketingCouponVerifyDTO;
import com.jeesharp.business.modules.marketing.coupon.dto.MarketingCouponVerifyRecordsQueryDTO;
import com.jeesharp.business.modules.marketing.coupon.vo.MarketingCouponVerifyCodeVO;
import com.jeesharp.business.modules.marketing.coupon.vo.MarketingCouponVerifyResultVO;
import com.jeesharp.business.modules.marketing.couponVerifyLog.vo.MemberCouponVerifyLogListVO;
import com.jeesharp.business.modules.marketing.memberTenant.application.MemberTenantApplicationService;
import com.jeesharp.business.modules.marketing.memberTenant.dto.MemberTenantJoinDTO;
import com.jeesharp.business.modules.marketing.memberTenant.vo.MemberTenantMobileVO;
import com.jeesharp.business.modules.marketing.tenant.application.MarketingTenantLandingApplicationService;
import com.jeesharp.business.modules.marketing.tenant.vo.MarketingTenantLandingVO;
import com.jeesharp.framework.pojo.query.PageRespVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * {@link MarketingMobileApi} 实现，委托各 Application Service。
 *
 * @author jeesharp
 * @since 2026-06-25
 */
@Service
@AllArgsConstructor
public class MarketingMobileApiImpl implements MarketingMobileApi {

    private final MarketingTenantLandingApplicationService marketingTenantLandingApplicationService;
    private final MemberTenantApplicationService memberTenantApplicationService;
    private final MarketingCouponApplicationService marketingCouponApplicationService;
    private final MarketingCouponVerifyApplicationService marketingCouponVerifyApplicationService;

    @Override
    public MarketingTenantLandingVO resolveLandingByScene(String scene) {
        return marketingTenantLandingApplicationService.resolveLandingByScene(scene);
    }

    @Override
    public MemberTenantMobileVO joinMemberTenant(String memberId, MemberTenantJoinDTO dto) {
        return memberTenantApplicationService.joinMemberTenant(memberId, dto);
    }

    @Override
    public List<MemberTenantMobileVO> listMyTenants(String memberId) {
        return memberTenantApplicationService.listMyTenants(memberId);
    }

    @Override
    public List<MemberTenantMobileVO> listMyClerkTenants(String memberId) {
        return memberTenantApplicationService.listMyClerkTenants(memberId);
    }

    @Override
    public PageRespVO<CouponDemoVO> pageAvailableCoupons(String memberId, MarketingCouponTenantQueryDTO dto) {
        return marketingCouponApplicationService.pageAvailableCoupons(memberId, dto);
    }

    @Override
    public Map<String, Object> receiveCoupon(String memberId, MarketingCouponReceiveDTO dto) {
        return marketingCouponApplicationService.receiveCoupon(memberId, dto);
    }

    @Override
    public PageRespVO<MemberCouponListVO> pageMyCoupons(String memberId, MarketingCouponTenantQueryDTO dto) {
        return marketingCouponApplicationService.pageMyCoupons(memberId, dto);
    }

    @Override
    public MemberCouponInfoVO getCouponDetail(String memberId, String tenantCode, String memberCouponId) {
        return marketingCouponApplicationService.getCouponDetail(memberId, tenantCode, memberCouponId);
    }

    @Override
    public CouponDemoVO getCouponWalletDetail(String memberId, String tenantCode, String memberCouponId) {
        return marketingCouponApplicationService.getCouponWalletDetail(memberId, tenantCode, memberCouponId);
    }

    @Override
    public MarketingCouponVerifyCodeVO createVerifyCode(String memberId, String tenantCode, String memberCouponId) {
        return marketingCouponVerifyApplicationService.createVerifyCode(memberId, tenantCode, memberCouponId);
    }

    @Override
    public MarketingCouponVerifyResultVO verifyCoupon(String operatorMemberId, MarketingCouponVerifyDTO dto) {
        return marketingCouponVerifyApplicationService.verifyCoupon(operatorMemberId, dto);
    }

    @Override
    public PageRespVO<MemberCouponVerifyLogListVO> pageVerifyRecords(String operatorMemberId,
                                                                     MarketingCouponVerifyRecordsQueryDTO dto) {
        return marketingCouponVerifyApplicationService.pageVerifyRecords(operatorMemberId, dto);
    }
}
