package com.eactive.testmaster.loadtest.mapper;

import com.eactive.testmaster.client.mapper.ApiScenarioMapper;
import com.eactive.testmaster.common.mapper.CommonMapper;
import com.eactive.testmaster.loadtest.dto.LoadTestDTO;
import com.eactive.testmaster.loadtest.entity.LoadTest;
import com.eactive.testmaster.server.mapper.ServerMapper;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.springframework.stereotype.Component;

@Mapper(componentModel = "spring",
    uses = {CommonMapper.class, ServerMapper.class, ApiScenarioMapper.class},
    unmappedTargetPolicy = ReportingPolicy.IGNORE)
@Component
public interface LoadTestMapper {

    @Mapping(target = "scenario", source = "scenarioId")
    LoadTest map(LoadTestDTO dto);

    @Mapping(target = "scenarioId", source = "scenario")
    LoadTestDTO map(LoadTest entity);

    List<LoadTestDTO> toDtoList(List<LoadTest> list);
}
