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

import de.effigenix.shared.common.PaymentTerms;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(requiredProperties = {"paymentDueDays", "paymentDescription"})
public record PaymentTermsResponse(
        int paymentDueDays,
        String paymentDescription
) {
    public static PaymentTermsResponse from(PaymentTerms pt) {
        if (pt == null) return null;
        return new PaymentTermsResponse(pt.paymentDueDays(), pt.description());
    }
}
