package ru.kayashov.bar.controller.dto.cocktail;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import ru.kayashov.bar.controller.dto.ingredient.IngredientSimpleResponseDto;
import ru.kayashov.bar.model.entity.ReceiptEntity;
import ru.kayashov.bar.model.entity.Unit;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReceiptResponseDto {
    private Long id;
    private IngredientSimpleResponseDto ingredient;
    private String measure;
    private Float count;
    private Unit unit;

    public static ReceiptResponseDto mapToDto(ReceiptEntity e) {
        ReceiptResponseDto d = new ReceiptResponseDto();
        d.id = e.getId();
        d.ingredient = IngredientSimpleResponseDto.mapToDto(e.getIngredient());
        d.measure = e.getMeasure();
        d.count = e.getCount();
        d.unit = e.getUnit();
        return d;
    }
}
