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

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

import java.time.LocalDate;

@Schema(requiredProperties = {"certificateType", "issuer", "validFrom", "validUntil"})
public record QualityCertificateResponse(
        String certificateType,
        String issuer,
        LocalDate validFrom,
        LocalDate validUntil
) {
    public static QualityCertificateResponse from(QualityCertificate cert) {
        return new QualityCertificateResponse(
                cert.certificateType(),
                cert.issuer(),
                cert.validFrom(),
                cert.validUntil()
        );
    }
}
