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

import de.effigenix.domain.masterdata.customer.DeliveryAddress;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(requiredProperties = {"label", "address", "contactPerson", "deliveryNotes"})
public record DeliveryAddressResponse(
        String label,
        AddressResponse address,
        String contactPerson,
        String deliveryNotes
) {
    public static DeliveryAddressResponse from(DeliveryAddress da) {
        return new DeliveryAddressResponse(
                da.label(),
                AddressResponse.from(da.address()),
                da.contactPerson(),
                da.deliveryNotes()
        );
    }
}
