package com.izouma.nineth.service;

import com.izouma.nineth.ApplicationTests;
import com.izouma.nineth.domain.*;
import com.izouma.nineth.repo.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import static org.junit.jupiter.api.Assertions.*;

class AssetServiceTest extends ApplicationTests {
    @Autowired
    private OrderRepo         orderRepo;
    @Autowired
    private BlindBoxItemRepo  blindBoxItemRepo;
    @Autowired
    private AssetService      assetService;
    @Autowired
    private CollectionRepo    collectionRepo;
    @Autowired
    private UserRepo          userRepo;
    @Autowired
    private CollectionService collectionService;
    @Autowired
    private AssetMintService  assetMintService;
    @Autowired
    private AssetRepo         assetRepo;

    @Test
    void createAsset() {
        BlindBoxItem item = blindBoxItemRepo.findById(1860L).get();
        Order order = orderRepo.findById(1922L).get();
    }

    @Test
    void cancelConsignment() {
        assetService.cancelConsignment(1209L);
    }

    @Test
    void testCancelConsignment() {
    }

    @Test
    public void testLock() throws InterruptedException {
        assetService.testLock("123", "ddd");
    }

    @Test
    public void testCreateAsset() {
        Order order = orderRepo.findById(4618L).get();
        Collection collection = collectionRepo.findById(order.getCollectionId()).get();
        BlindBoxItem blindBoxItem = blindBoxItemRepo.findById(4250L).get();
        User user = userRepo.findById(order.getUserId()).get();
        assetService.createAsset(blindBoxItem, user, order.getId(), order.getPrice(), "出售", 1);
    }

    @Test
    public void mint() {
        Asset asset = assetRepo.findById(4622L).get();
        assetMintService.mint(asset, 1L);
    }

    @Test
    public void setHistory() {
        assetService.setHistory();
    }
}