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

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

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

  @Named("variableCategoryName")
  @BeanMapping(ignoreByDefault = true)
  @Mapping(target = "id", source = "id")
  @Mapping(target = "name", source = "name")
  @Mapping(target = "version", source = "version")
  VariableCategoryDTO toDtoVariableCategoryName(VariableCategory variableCategory);
}
