package com.oguerreiro.resilient.service.mapper;

import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;

import com.oguerreiro.resilient.domain.VariableClass;
import com.oguerreiro.resilient.domain.VariableClassType;
import com.oguerreiro.resilient.service.dto.VariableClassDTO;
import com.oguerreiro.resilient.service.dto.VariableClassTypeDTO;

/**
 * Mapper for the entity {@link VariableClass} and its DTO {@link VariableClassDTO}.
 */
@Mapper(componentModel = "spring")
public interface VariableClassMapper extends ResilientEntityMapper<VariableClassDTO, VariableClass> {
    @Mapping(target = "variableClassType", source = "variableClassType", qualifiedByName = "variableClassTypeName")
    VariableClassDTO toDto(VariableClass s);

    @Named("variableClassTypeName")
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "id", source = "id")
    @Mapping(target = "name", source = "name")
    VariableClassTypeDTO toDtoVariableClassTypeName(VariableClassType variableClassType);
}
