package com.liquidnet.service.goblin.test;


import com.liquidnet.service.goblin.param.shouqianba.request.CommonRequest;
import com.liquidnet.service.goblin.param.shouqianba.request.MallListQueryRequest;
import com.liquidnet.service.goblin.param.shouqianba.request.MallProductsQueryRequest;
import com.liquidnet.service.goblin.param.shouqianba.response.data.MallListQueryData;
import com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData;
import com.liquidnet.service.goblin.service.IGoblinShouQianBaService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@Slf4j
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class GoblinShouQianBaServiceImplTest {

    @Autowired
    private IGoblinShouQianBaService goblinShouQianBaService;


    @Test
    public void queryMallListTest(){

        CommonRequest.Seller seller = new CommonRequest.Seller();
        seller.setRole("super_admin");
        seller.setMerchantId("1c904b2df056-4afa-a819-0328a4774320");
        seller.setMerchantUserId("6ce169d1-1289-4e98-b4a3-ea8b6145046f");

        MallListQueryRequest.Filter filter = new MallListQueryRequest.Filter();
        filter.setSeller(seller);

        MallListQueryRequest.Cursor cursor = new MallListQueryRequest.Cursor();
        cursor.setCount(10);
        cursor.setCursorField("id");

        MallListQueryRequest.Sort sort = new MallListQueryRequest.Sort();
        sort.setSort("DESC");
        sort.setSortField("id");

        MallListQueryRequest mallListQueryRequest = new MallListQueryRequest();
        mallListQueryRequest.setAppid("2025082700005615");
        mallListQueryRequest.setFilter(filter);
        mallListQueryRequest.setCursor(cursor);
        mallListQueryRequest.setSort(sort);

        List<MallListQueryData> mallListQueryData = goblinShouQianBaService.queryMallList(mallListQueryRequest);
        Assert.assertNotNull(mallListQueryData);
    }

    @Test
    public void queryMallProductsTest(){

        CommonRequest.Seller seller = new CommonRequest.Seller();
        seller.setMerchantId("1c904b2d-f056-4afa-a819-0328a4774320");
        seller.setMerchantUserId("6ce169d1-1289-4e98-b4a3-ea8b6145046f");
        seller.setRole("super_admin");

        CommonRequest.Mall mall = new CommonRequest.Mall();
        mall.setMallSn("2025082811504809748");
        mall.setSignature("9GB99V5iqvg-J_mhjYzs");

        MallProductsQueryRequest mallProductsQueryRequest = new MallProductsQueryRequest();
        mallProductsQueryRequest.setAppid("2025082700005615");
        mallProductsQueryRequest.setSeller(seller);
        mallProductsQueryRequest.setMallID(mall);

        List<MallProductsQueryData> queryData = goblinShouQianBaService.queryMallProducts(mallProductsQueryRequest);
        Assert.assertNotNull(queryData);
    }

}
