package de.effigenix.infrastructure.masterdata.web.dto;

import de.effigenix.domain.masterdata.supplier.SupplierRating;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(requiredProperties = {"qualityScore", "deliveryScore", "priceScore"})
public record SupplierRatingResponse(
        int qualityScore,
        int deliveryScore,
        int priceScore
) {
    public static SupplierRatingResponse from(SupplierRating rating) {
        if (rating == null) return null;
        return new SupplierRatingResponse(
                rating.qualityScore(),
                rating.deliveryScore(),
                rating.priceScore()
        );
    }
}
