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

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import ru.kayashov.bar.model.entity.IngredientEntity;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class IngredientResponseDto {
    private Long id;
    private String name;
//    private String enName;
    private Boolean alcohol;
    private Integer abv;
    private boolean isHave;
    private String type;
    private String image;
    private String description;


    public static IngredientResponseDto mapToDto(IngredientEntity i) {
        return IngredientResponseDto
                .builder()
                .id(i.getId())
                .name(i.getName())
//                .enName(i.getEnName())
                .alcohol(i.getAlcohol())
                .type(i.getType() != null ? i.getType().getName() : null)
                .abv(i.getAbv())
//                .isHave(i.getIsHave())
                .image("https://thecocktaildb.com/images/ingredients/" + i.getEnName() + "-Medium.png")
                .description(i.getDescription())
                .build();
    }
}
