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.VariableCategory;
import com.oguerreiro.resilient.domain.VariableScope;
import com.oguerreiro.resilient.service.dto.VariableCategoryDTO;
import com.oguerreiro.resilient.service.dto.VariableScopeDTO;

/**
 * Mapper for the entity {@link VariableCategory} and its DTO
 * {@link VariableCategoryDTO}.
 */
@Mapper(componentModel = "spring")
public interface VariableCategoryMapper extends ResilientEntityMapper<VariableCategoryDTO, VariableCategory> {
  @Mapping(target = "variableScope", source = "variableScope", qualifiedByName = "variableScopeName")
  VariableCategoryDTO toDto(VariableCategory s);

  @Named("variableScopeName")
  @BeanMapping(ignoreByDefault = true)
  @Mapping(target = "id", source = "id")
  @Mapping(target = "name", source = "name")
  @Mapping(target = "code", source = "code")
  @Mapping(target = "version", source = "version")
  VariableScopeDTO toDtoVariableScopeName(VariableScope variableScope);
}
