// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.edgeorder.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.edgeorder.models.AddressValidationStatus;
import com.azure.resourcemanager.edgeorder.models.ContactDetails;
import com.azure.resourcemanager.edgeorder.models.ShippingAddress;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Address Resource. */
@Fluent
public final class AddressResourceInner extends Resource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(AddressResourceInner.class);

    /*
     * Properties of an address.
     */
    @JsonProperty(value = "properties", required = true)
    private AddressProperties innerProperties = new AddressProperties();

    /*
     * Represents resource creation and update time
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /**
     * Get the innerProperties property: Properties of an address.
     *
     * @return the innerProperties value.
     */
    private AddressProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Represents resource creation and update time.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public AddressResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AddressResourceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the shippingAddress property: Shipping details for the address.
     *
     * @return the shippingAddress value.
     */
    public ShippingAddress shippingAddress() {
        return this.innerProperties() == null ? null : this.innerProperties().shippingAddress();
    }

    /**
     * Set the shippingAddress property: Shipping details for the address.
     *
     * @param shippingAddress the shippingAddress value to set.
     * @return the AddressResourceInner object itself.
     */
    public AddressResourceInner withShippingAddress(ShippingAddress shippingAddress) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AddressProperties();
        }
        this.innerProperties().withShippingAddress(shippingAddress);
        return this;
    }

    /**
     * Get the contactDetails property: Contact details for the address.
     *
     * @return the contactDetails value.
     */
    public ContactDetails contactDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().contactDetails();
    }

    /**
     * Set the contactDetails property: Contact details for the address.
     *
     * @param contactDetails the contactDetails value to set.
     * @return the AddressResourceInner object itself.
     */
    public AddressResourceInner withContactDetails(ContactDetails contactDetails) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AddressProperties();
        }
        this.innerProperties().withContactDetails(contactDetails);
        return this;
    }

    /**
     * Get the addressValidationStatus property: Status of address validation.
     *
     * @return the addressValidationStatus value.
     */
    public AddressValidationStatus addressValidationStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().addressValidationStatus();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model AddressResourceInner"));
        } else {
            innerProperties().validate();
        }
    }
}
