package com.izouma.nineth.service;

import com.izouma.nineth.ApplicationTests;
import com.izouma.nineth.domain.AuctionActivity;
import com.izouma.nineth.dto.auction.AuctionInputDTO;
import com.izouma.nineth.enums.AuctionStatus;
import com.izouma.nineth.repo.AuctionActivityRepo;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.time.LocalDateTime;


public class AuctionActivityServiceTest extends ApplicationTests {

    @Autowired
    private AuctionActivityService auctionActivityService;
    @Autowired
    private AuctionActivityRepo    auctionActivityRepo;

    @Test
    public void test() {
        auctionActivityService.init();
    }

    @Test
    public void test1() {
        AuctionActivity activity = auctionActivityRepo.findById(2652491L).orElse(null);

        auctionActivityService.offShelfTask(activity);
    }

    @Test
    public void test2() {
        AuctionInputDTO dto = new AuctionInputDTO();
        dto.setAssetId(206885L);
        dto.setDeposit(new BigDecimal("0.1"));
        dto.setStartTime(LocalDateTime.now());
        dto.setFixedPrice(new BigDecimal("0.01"));
        dto.setIncrement(new BigDecimal("0.01"));
        dto.setTradeCode("123456");
        auctionActivityService.createFromAsset(dto);

    }

    @Test
    public void test3() {
        auctionActivityRepo.updateStatus(2680842L, AuctionStatus.PASS);
    }
}