package de.htwsaar.webshop.model;

import de.htwsaar.webshop.repository.entities.Article;
import de.htwsaar.webshop.repository.entities.FarmImage;
import de.htwsaar.webshop.repository.entities.Image;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.UUID;

/**
 * What the Frontend gets when requesting an Article, POJO
 */
@AllArgsConstructor
@Setter
@Getter
public class ArticleWithFarmImageModel {
    private long id;
    private UUID uuid;
    private String name;
    private String description;
    private int price100;
    private int discount100;
    private int stock;
    private int stockExpected;
    private String category;
    private double rating;
    private String image;
    private String farmImage;

    public ArticleWithFarmImageModel(ArticleModel article, Image image, FarmImage farmImage) {
        this.id = article.getId();
        this.uuid = article.getUuid();
        this.name = article.getName();
        this.description = article.getDescription();
        this.price100 = article.getPrice100();
        this.discount100 = article.getDiscount100();
        this.stock = article.getStock();
        this.stockExpected = article.getStockExpected();
        this.category = article.getCategory();
        this.rating = article.getRating();
        this.image = image.getBase64();
        this.farmImage = farmImage.getBase64();
    }
}
