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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.graphservices.models.AccountResourceProperties;
import com.azure.resourcemanager.graphservices.models.AccountResourceSystemData;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Account details. */
@Fluent
public final class AccountResourceInner extends Resource {
    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private AccountResourceSystemData systemData;

    /*
     * Property bag from billing account
     */
    @JsonProperty(value = "properties", required = true)
    private AccountResourceProperties properties;

    /** Creates an instance of AccountResourceInner class. */
    public AccountResourceInner() {
    }

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public AccountResourceSystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the properties property: Property bag from billing account.
     *
     * @return the properties value.
     */
    public AccountResourceProperties properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Property bag from billing account.
     *
     * @param properties the properties value to set.
     * @return the AccountResourceInner object itself.
     */
    public AccountResourceInner withProperties(AccountResourceProperties properties) {
        this.properties = properties;
        return this;
    }

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

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

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

    private static final ClientLogger LOGGER = new ClientLogger(AccountResourceInner.class);
}
