// 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.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.edgeorder.models.StageDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Specifies the properties or parameters for an order. Order is a grouping of one or more order items. */
@Fluent
public final class OrderResourceInner extends ProxyResource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(OrderResourceInner.class);

    /*
     * Order properties
     */
    @JsonProperty(value = "properties", required = true)
    private OrderProperties innerProperties = new OrderProperties();

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

    /**
     * Get the innerProperties property: Order properties.
     *
     * @return the innerProperties value.
     */
    private OrderProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Get the orderItemIds property: List of order item ARM Ids which are part of an order.
     *
     * @return the orderItemIds value.
     */
    public List<String> orderItemIds() {
        return this.innerProperties() == null ? null : this.innerProperties().orderItemIds();
    }

    /**
     * Get the currentStage property: Order current status.
     *
     * @return the currentStage value.
     */
    public StageDetails currentStage() {
        return this.innerProperties() == null ? null : this.innerProperties().currentStage();
    }

    /**
     * Get the orderStageHistory property: Order status history.
     *
     * @return the orderStageHistory value.
     */
    public List<StageDetails> orderStageHistory() {
        return this.innerProperties() == null ? null : this.innerProperties().orderStageHistory();
    }

    /**
     * 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 OrderResourceInner"));
        } else {
            innerProperties().validate();
        }
    }
}
