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

package com.azure.resourcemanager.databoxedge.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Represents a single status change. */
@Fluent
public final class OrderStatus {
    /*
     * Status of the order as per the allowed status types.
     */
    @JsonProperty(value = "status", required = true)
    private OrderState status;

    /*
     * Time of status update.
     */
    @JsonProperty(value = "updateDateTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime updateDateTime;

    /*
     * Comments related to this status change.
     */
    @JsonProperty(value = "comments")
    private String comments;

    /*
     * Dictionary to hold generic information which is not stored
     * by the already existing properties
     */
    @JsonProperty(value = "additionalOrderDetails", access = JsonProperty.Access.WRITE_ONLY)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> additionalOrderDetails;

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

    /**
     * Get the status property: Status of the order as per the allowed status types.
     *
     * @return the status value.
     */
    public OrderState status() {
        return this.status;
    }

    /**
     * Set the status property: Status of the order as per the allowed status types.
     *
     * @param status the status value to set.
     * @return the OrderStatus object itself.
     */
    public OrderStatus withStatus(OrderState status) {
        this.status = status;
        return this;
    }

    /**
     * Get the updateDateTime property: Time of status update.
     *
     * @return the updateDateTime value.
     */
    public OffsetDateTime updateDateTime() {
        return this.updateDateTime;
    }

    /**
     * Get the comments property: Comments related to this status change.
     *
     * @return the comments value.
     */
    public String comments() {
        return this.comments;
    }

    /**
     * Set the comments property: Comments related to this status change.
     *
     * @param comments the comments value to set.
     * @return the OrderStatus object itself.
     */
    public OrderStatus withComments(String comments) {
        this.comments = comments;
        return this;
    }

    /**
     * Get the additionalOrderDetails property: Dictionary to hold generic information which is not stored by the
     * already existing properties.
     *
     * @return the additionalOrderDetails value.
     */
    public Map<String, String> additionalOrderDetails() {
        return this.additionalOrderDetails;
    }

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

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