package com.oguerreiro.resilient.service.mapper;

import java.util.List;

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

import com.oguerreiro.resilient.domain.DashboardComponentDetailValue;
import com.oguerreiro.resilient.domain.InventoryData;
import com.oguerreiro.resilient.domain.Unit;
import com.oguerreiro.resilient.domain.Variable;
import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO;
import com.oguerreiro.resilient.service.dto.InventoryDataDTO;
import com.oguerreiro.resilient.service.dto.UnitDTO;
import com.oguerreiro.resilient.service.dto.VariableDTO;

/**
 * Mapper for the entity {@link DashboardComponentDetailValue} and its DTO {@link DashboardComponentDetailValueDTO}.
 */
@Mapper(componentModel = "spring")
public interface InventoryDataMapper {
  // extends ResilientEntityMapper<DashboardComponentDetailValueDTO, DashboardComponentDetailValue> {
  @Mapping(target = "variable", source = "variable", qualifiedByName = "variablePropertyName")
  @Mapping(target = "unit", source = "unit", qualifiedByName = "unitPropertyName")
  InventoryDataDTO toDto(InventoryData inventoryData);

  @Named("unitPropertyName")
  @BeanMapping(ignoreByDefault = true)
  @Mapping(target = "id", source = "id")
  @Mapping(target = "symbol", source = "symbol")
  UnitDTO toDtoUnitPropertyName(Unit unit);

  @Named("variablePropertyName")
  @BeanMapping(ignoreByDefault = true)
  @Mapping(target = "id", source = "id")
  @Mapping(target = "name", source = "name")
  VariableDTO toDtoVariablePropertyName(Variable variable);

  List<InventoryDataDTO> toDto(List<InventoryData> inventoryDataList);

}
