package app.mealsmadeeasy.api.recipe.view;

import app.mealsmadeeasy.api.image.view.ImageView;
import app.mealsmadeeasy.api.user.view.UserInfoView;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Value;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;
import java.util.List;

@Value
@Builder
public class FullRecipeView {

    @Builder
    public record IngredientView(@Nullable String amount, String name, @Nullable String notes) {}

    Integer id;
    OffsetDateTime created;
    @Nullable OffsetDateTime modified;
    String slug;
    String title;
    @Nullable Integer preparationTime;
    @Nullable Integer cookingTime;
    @Nullable Integer totalTime;
    @Nullable List<IngredientView> ingredients;
    String text;
    @Nullable String rawText;
    UserInfoView owner;
    int starCount;
    int viewerCount;
    @Nullable ImageView mainImage;
    boolean isPublic;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    public @Nullable String getRawText() {
        return this.rawText;
    }

}
