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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Describes a supported operation by the Storage Import/Export job API. */
@Fluent
public final class OperationInner {
    /*
     * Name of the operation.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * operation display properties
     */
    @JsonProperty(value = "display", required = true)
    private OperationDisplay innerDisplay = new OperationDisplay();

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

    /**
     * Get the name property: Name of the operation.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the operation.
     *
     * @param name the name value to set.
     * @return the OperationInner object itself.
     */
    public OperationInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the innerDisplay property: operation display properties.
     *
     * @return the innerDisplay value.
     */
    private OperationDisplay innerDisplay() {
        return this.innerDisplay;
    }

    /**
     * Get the provider property: The resource provider name to which the operation belongs.
     *
     * @return the provider value.
     */
    public String provider() {
        return this.innerDisplay() == null ? null : this.innerDisplay().provider();
    }

    /**
     * Set the provider property: The resource provider name to which the operation belongs.
     *
     * @param provider the provider value to set.
     * @return the OperationInner object itself.
     */
    public OperationInner withProvider(String provider) {
        if (this.innerDisplay() == null) {
            this.innerDisplay = new OperationDisplay();
        }
        this.innerDisplay().withProvider(provider);
        return this;
    }

    /**
     * Get the resource property: The name of the resource to which the operation belongs.
     *
     * @return the resource value.
     */
    public String resource() {
        return this.innerDisplay() == null ? null : this.innerDisplay().resource();
    }

    /**
     * Set the resource property: The name of the resource to which the operation belongs.
     *
     * @param resource the resource value to set.
     * @return the OperationInner object itself.
     */
    public OperationInner withResource(String resource) {
        if (this.innerDisplay() == null) {
            this.innerDisplay = new OperationDisplay();
        }
        this.innerDisplay().withResource(resource);
        return this;
    }

    /**
     * Get the operation property: The display name of the operation.
     *
     * @return the operation value.
     */
    public String operation() {
        return this.innerDisplay() == null ? null : this.innerDisplay().operation();
    }

    /**
     * Set the operation property: The display name of the operation.
     *
     * @param operation the operation value to set.
     * @return the OperationInner object itself.
     */
    public OperationInner withOperation(String operation) {
        if (this.innerDisplay() == null) {
            this.innerDisplay = new OperationDisplay();
        }
        this.innerDisplay().withOperation(operation);
        return this;
    }

    /**
     * Get the description property: Short description of the operation.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerDisplay() == null ? null : this.innerDisplay().description();
    }

    /**
     * Set the description property: Short description of the operation.
     *
     * @param description the description value to set.
     * @return the OperationInner object itself.
     */
    public OperationInner withDescription(String description) {
        if (this.innerDisplay() == null) {
            this.innerDisplay = new OperationDisplay();
        }
        this.innerDisplay().withDescription(description);
        return this;
    }

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

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