// 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.models;

import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.edgeorder.fluent.models.AddressProperties;
import com.azure.resourcemanager.edgeorder.fluent.models.OrderItemResourceInner;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** An immutable client-side representation of OrderItemResource. */
public interface OrderItemResource {
    /**
     * Gets the id property: Fully qualified resource Id for the resource.
     *
     * @return the id value.
     */
    String id();

    /**
     * Gets the name property: The name of the resource.
     *
     * @return the name value.
     */
    String name();

    /**
     * Gets the type property: The type of the resource.
     *
     * @return the type value.
     */
    String type();

    /**
     * Gets the location property: The geo-location where the resource lives.
     *
     * @return the location value.
     */
    String location();

    /**
     * Gets the tags property: Resource tags.
     *
     * @return the tags value.
     */
    Map<String, String> tags();

    /**
     * Gets the systemData property: Represents resource creation and update time.
     *
     * @return the systemData value.
     */
    SystemData systemData();

    /**
     * Gets the orderItemDetails property: Represents order item details.
     *
     * @return the orderItemDetails value.
     */
    OrderItemDetails orderItemDetails();

    /**
     * Gets the addressDetails property: Represents shipping and return address for order item.
     *
     * @return the addressDetails value.
     */
    AddressDetails addressDetails();

    /**
     * Gets the startTime property: Start time of order item.
     *
     * @return the startTime value.
     */
    OffsetDateTime startTime();

    /**
     * Gets the orderId property: Id of the order to which order item belongs to.
     *
     * @return the orderId value.
     */
    String orderId();

    /**
     * Gets the region of the resource.
     *
     * @return the region of the resource.
     */
    Region region();

    /**
     * Gets the name of the resource region.
     *
     * @return the name of the resource region.
     */
    String regionName();

    /**
     * Gets the inner com.azure.resourcemanager.edgeorder.fluent.models.OrderItemResourceInner object.
     *
     * @return the inner object.
     */
    OrderItemResourceInner innerModel();

    /** The entirety of the OrderItemResource definition. */
    interface Definition
        extends DefinitionStages.Blank,
            DefinitionStages.WithLocation,
            DefinitionStages.WithResourceGroup,
            DefinitionStages.WithOrderItemDetails,
            DefinitionStages.WithAddressDetails,
            DefinitionStages.WithOrderId,
            DefinitionStages.WithCreate {
    }
    /** The OrderItemResource definition stages. */
    interface DefinitionStages {
        /** The first stage of the OrderItemResource definition. */
        interface Blank extends WithLocation {
        }
        /** The stage of the OrderItemResource definition allowing to specify location. */
        interface WithLocation {
            /**
             * Specifies the region for the resource.
             *
             * @param location The geo-location where the resource lives.
             * @return the next definition stage.
             */
            WithResourceGroup withRegion(Region location);

            /**
             * Specifies the region for the resource.
             *
             * @param location The geo-location where the resource lives.
             * @return the next definition stage.
             */
            WithResourceGroup withRegion(String location);
        }
        /** The stage of the OrderItemResource definition allowing to specify parent resource. */
        interface WithResourceGroup {
            /**
             * Specifies resourceGroupName.
             *
             * @param resourceGroupName The name of the resource group. The name is case insensitive.
             * @return the next definition stage.
             */
            WithOrderItemDetails withExistingResourceGroup(String resourceGroupName);
        }
        /** The stage of the OrderItemResource definition allowing to specify orderItemDetails. */
        interface WithOrderItemDetails {
            /**
             * Specifies the orderItemDetails property: Represents order item details..
             *
             * @param orderItemDetails Represents order item details.
             * @return the next definition stage.
             */
            WithAddressDetails withOrderItemDetails(OrderItemDetails orderItemDetails);
        }
        /** The stage of the OrderItemResource definition allowing to specify addressDetails. */
        interface WithAddressDetails {
            /**
             * Specifies the addressDetails property: Represents shipping and return address for order item.
             *
             * @param addressDetails Represents shipping and return address for order item.
             * @return the next definition stage.
             */
            WithOrderId withAddressDetails(AddressDetails addressDetails);
        }
        /** The stage of the OrderItemResource definition allowing to specify orderId. */
        interface WithOrderId {
            /**
             * Specifies the orderId property: Id of the order to which order item belongs to.
             *
             * @param orderId Id of the order to which order item belongs to.
             * @return the next definition stage.
             */
            WithCreate withOrderId(String orderId);
        }
        /**
         * The stage of the OrderItemResource definition which contains all the minimum required properties for the
         * resource to be created, but also allows for any other optional properties to be specified.
         */
        interface WithCreate extends DefinitionStages.WithTags {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            OrderItemResource create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            OrderItemResource create(Context context);
        }
        /** The stage of the OrderItemResource definition allowing to specify tags. */
        interface WithTags {
            /**
             * Specifies the tags property: Resource tags..
             *
             * @param tags Resource tags.
             * @return the next definition stage.
             */
            WithCreate withTags(Map<String, String> tags);
        }
    }
    /**
     * Begins update for the OrderItemResource resource.
     *
     * @return the stage of resource update.
     */
    OrderItemResource.Update update();

    /** The template for OrderItemResource update. */
    interface Update
        extends UpdateStages.WithTags,
            UpdateStages.WithForwardAddress,
            UpdateStages.WithPreferences,
            UpdateStages.WithNotificationEmailList,
            UpdateStages.WithIfMatch {
        /**
         * Executes the update request.
         *
         * @return the updated resource.
         */
        OrderItemResource apply();

        /**
         * Executes the update request.
         *
         * @param context The context to associate with this operation.
         * @return the updated resource.
         */
        OrderItemResource apply(Context context);
    }
    /** The OrderItemResource update stages. */
    interface UpdateStages {
        /** The stage of the OrderItemResource update allowing to specify tags. */
        interface WithTags {
            /**
             * Specifies the tags property: The list of key value pairs that describe the resource. These tags can be
             * used in viewing and grouping this resource (across resource groups)..
             *
             * @param tags The list of key value pairs that describe the resource. These tags can be used in viewing and
             *     grouping this resource (across resource groups).
             * @return the next definition stage.
             */
            Update withTags(Map<String, String> tags);
        }
        /** The stage of the OrderItemResource update allowing to specify forwardAddress. */
        interface WithForwardAddress {
            /**
             * Specifies the forwardAddress property: Updates forward shipping address and contact details..
             *
             * @param forwardAddress Updates forward shipping address and contact details.
             * @return the next definition stage.
             */
            Update withForwardAddress(AddressProperties forwardAddress);
        }
        /** The stage of the OrderItemResource update allowing to specify preferences. */
        interface WithPreferences {
            /**
             * Specifies the preferences property: Customer preference..
             *
             * @param preferences Customer preference.
             * @return the next definition stage.
             */
            Update withPreferences(Preferences preferences);
        }
        /** The stage of the OrderItemResource update allowing to specify notificationEmailList. */
        interface WithNotificationEmailList {
            /**
             * Specifies the notificationEmailList property: Additional notification email list..
             *
             * @param notificationEmailList Additional notification email list.
             * @return the next definition stage.
             */
            Update withNotificationEmailList(List<String> notificationEmailList);
        }
        /** The stage of the OrderItemResource update allowing to specify ifMatch. */
        interface WithIfMatch {
            /**
             * Specifies the ifMatch property: Defines the If-Match condition. The patch will be performed only if the
             * ETag of the order on the server matches this value..
             *
             * @param ifMatch Defines the If-Match condition. The patch will be performed only if the ETag of the order
             *     on the server matches this value.
             * @return the next definition stage.
             */
            Update withIfMatch(String ifMatch);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    OrderItemResource refresh();

    /**
     * Refreshes the resource to sync with Azure.
     *
     * @param context The context to associate with this operation.
     * @return the refreshed resource.
     */
    OrderItemResource refresh(Context context);

    /**
     * Cancel order item.
     *
     * @param cancellationReason Reason for cancellation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void cancelOrderItem(CancellationReason cancellationReason);

    /**
     * Cancel order item.
     *
     * @param cancellationReason Reason for cancellation.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    Response<Void> cancelOrderItemWithResponse(CancellationReason cancellationReason, Context context);

    /**
     * Return order item.
     *
     * @param returnOrderItemDetails Return order item CurrentStatus.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void returnOrderItem(ReturnOrderItemDetails returnOrderItemDetails);

    /**
     * Return order item.
     *
     * @param returnOrderItemDetails Return order item CurrentStatus.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void returnOrderItem(ReturnOrderItemDetails returnOrderItemDetails, Context context);
}
