import React from 'react';

interface AddressProps {
  address: {
    address_1?: string;
    address_2?: string;
    city?: string;
    state?: string;
    postcode?: string;
    country?: string;
    phone?: string;
  };
  style?: React.CSSProperties;
}

const Address: React.FC<AddressProps> = ({ address, style }) => {
  if (!address) {
    return <span>-</span>;
  }

  const { address_1, address_2, city, state, postcode, country, phone } =
    address;

  return (
    <div style={{ fontSize: 12, ...style }}>
      <div>
        {address_1} {address_2}
      </div>
      <div>
        {city}, {state}, {postcode}
      </div>
      <div>{country}</div>
      <div>{phone}</div>
    </div>
  );
};

export default Address;
