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

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

@Schema(requiredProperties = {"street", "houseNumber", "postalCode", "city", "country"})
public record AddressResponse(
        String street,
        String houseNumber,
        String postalCode,
        String city,
        String country
) {
    public static AddressResponse from(Address address) {
        if (address == null) return null;
        return new AddressResponse(
                address.street(),
                address.houseNumber(),
                address.postalCode(),
                address.city(),
                address.country()
        );
    }
}
