package cd.casic.ci.process.process.converter;

import cd.casic.ci.process.dto.req.target.TargetManagerCreateReq;
import cd.casic.ci.process.dto.req.target.TargetVersionCreateReq;
import cd.casic.ci.process.dto.req.target.TargetVersionUpdateReq;
import cd.casic.ci.process.dto.resp.target.TargetVersionResp;
import cd.casic.ci.process.process.dataObject.target.TargetVersion;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author HopeLi
 * @version v1.0
 * @ClassName PipelineConverter
 * @Date: 2025/5/13 14:39
 * @Description:
 */
@Mapper(componentModel = "spring",nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface TargetVersionConverter {
    TargetVersionConverter INSTANCE = Mappers.getMapper(TargetVersionConverter.class);

    TargetVersionResp toResp(TargetVersion targetVersion);
    List<TargetVersionResp> toRespList(List<TargetVersion> targetVersions);

    void updateReqCopyToTargetVersion(TargetVersionUpdateReq req,@MappingTarget TargetVersion targetVersion);

    TargetVersion targetCreateReqToTargetVersionBean(TargetManagerCreateReq req);
    TargetVersionCreateReq targetCreateReqToTargetVersionCreateReq(TargetManagerCreateReq req);

    TargetVersion versionCreateReqToTargetVersionBean(TargetVersionCreateReq req);
}
