package com.kakao.usermgmt.response;

import com.bytedance.covode.number.Covode;
import com.kakao.network.response.JSONObjectResponse;
import com.kakao.network.response.ResponseStringConverter;
import com.kakao.usermgmt.response.model.ShippingAddress;
import com.kakao.util.OptionalBoolean;
import java.util.List;

public class ShippingAddressResponse extends JSONObjectResponse {
    public static final ResponseStringConverter<ShippingAddressResponse> CONVERTER = new ResponseStringConverter<ShippingAddressResponse>() {
        static {
            Covode.recordClassIndex(45960);
        }

        public final ShippingAddressResponse convert(String str) {
            return new ShippingAddressResponse(str);
        }
    };
    public final OptionalBoolean hasShippingAddresses;
    public final List<ShippingAddress> shippingAddresses;
    public final OptionalBoolean shippingAddressesNeedsAgreement;
    public final Long userId;

    public List<ShippingAddress> getShippingAddresses() {
        return this.shippingAddresses;
    }

    public Long getUserId() {
        return this.userId;
    }

    public OptionalBoolean hasShippingAddresses() {
        return this.hasShippingAddresses;
    }

    public OptionalBoolean shippingAddressesNeedsAgreement() {
        return this.shippingAddressesNeedsAgreement;
    }

    static {
        Covode.recordClassIndex(45959);
    }

    public ShippingAddressResponse(String str) {
        super(str);
        Long l;
        OptionalBoolean optionalBoolean;
        OptionalBoolean optionalBoolean2;
        List<ShippingAddress> list = null;
        if (getBody().has("user_id")) {
            l = Long.valueOf(getBody().getLong("user_id"));
        } else {
            l = null;
        }
        this.userId = l;
        if (getBody().has("has_shipping_addresses")) {
            optionalBoolean = OptionalBoolean.getOptionalBoolean(Boolean.valueOf(getBody().getBoolean("has_shipping_addresses")));
        } else {
            optionalBoolean = null;
        }
        this.hasShippingAddresses = optionalBoolean;
        if (getBody().has("shipping_addresses_needs_agreement")) {
            optionalBoolean2 = OptionalBoolean.getOptionalBoolean(Boolean.valueOf(getBody().getBoolean("shipping_addresses_needs_agreement")));
        } else {
            optionalBoolean2 = null;
        }
        this.shippingAddressesNeedsAgreement = optionalBoolean2;
        this.shippingAddresses = getBody().has("shipping_addresses") ? ShippingAddress.CONVERTER.convertList(getBody().getJSONArray("shipping_addresses")) : list;
    }
}
