import com.fs.audit.chain.AuditResult;
import com.fs.audit.domain.AuditFlow;
import com.fs.audit.dto.AuditRequestDTO;
import com.fs.audit.dto.CreateAuditRequestDTO;
import com.fs.audit.enums.AuditTypeEnum;
import com.fs.audit.service.AuditService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class AuditTest extends BaseSpringBootTest{


    @Autowired
    private AuditService auditService;

    @Test
    void createAudit(){
        CreateAuditRequestDTO requestDTO = new CreateAuditRequestDTO();
        requestDTO.setBusinessId(1L);
        requestDTO.setBusinessType(AuditTypeEnum.GRADE_AUDIT.getCode());
        requestDTO.setTempCode(AuditTypeEnum.GRADE_AUDIT.getCode());
        requestDTO.setInitiatorId(0L);
        requestDTO.setCompanyId(1L);
        Long audit = auditService.createAudit(requestDTO);
    }

    @Test
    void doAudit(){
        AuditRequestDTO requestDTO = new AuditRequestDTO();
        requestDTO.setAuditId(139L);
        requestDTO.setUserId(1001L);
        requestDTO.setUserType(1);
        requestDTO.setAction(2);
        AuditResult auditResult = auditService.doAudit(requestDTO);
        System.out.println(auditResult);
    }

    @Test
    void getAuditFlows(){
        List<AuditFlow> auditFlows = auditService.getAuditFlows(139L);
        logger.info(": {}",auditFlows);
    }

}
