package com.liquidnet.service.goblin.test;


import com.liquidnet.common.third.sqb.biz.SqbBiz;
import com.liquidnet.common.third.sqb.param.request.CommonRequest;
import com.liquidnet.common.third.sqb.param.request.MallListQueryRequest;
import com.liquidnet.common.third.sqb.param.request.MallProductsQueryRequest;
import com.liquidnet.common.third.sqb.param.response.data.MallListQueryData;
import com.liquidnet.common.third.sqb.param.response.data.MallProductsQueryData;
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 SqbBiz sqbBiz;


    @Test
    public void queryMallListTest(){

        CommonRequest.Seller seller = new CommonRequest.Seller();
        seller.setRole("super_admin");
        seller.setMerchantId("fd567f94-9a44-4ae5-879f-9acc919d0f89");
        seller.setMerchantUserId("42c556cc-1509-4de0-bfc3-dfbcb48eae57");

        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 = sqbBiz.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 = sqbBiz.queryMallProducts(mallProductsQueryRequest);
        Assert.assertNotNull(queryData);
    }

}
