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

package com.azure.resourcemanager.storagepool.models;

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

/** LUN to expose the Azure Managed Disk. */
@Fluent
public final class IscsiLun {
    /*
     * User defined name for iSCSI LUN; example: "lun0"
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Azure Resource ID of the Managed Disk.
     */
    @JsonProperty(value = "managedDiskAzureResourceId", required = true)
    private String managedDiskAzureResourceId;

    /*
     * Specifies the Logical Unit Number of the iSCSI LUN.
     */
    @JsonProperty(value = "lun", access = JsonProperty.Access.WRITE_ONLY)
    private Integer lun;

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

    /**
     * Get the name property: User defined name for iSCSI LUN; example: "lun0".
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: User defined name for iSCSI LUN; example: "lun0".
     *
     * @param name the name value to set.
     * @return the IscsiLun object itself.
     */
    public IscsiLun withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the managedDiskAzureResourceId property: Azure Resource ID of the Managed Disk.
     *
     * @return the managedDiskAzureResourceId value.
     */
    public String managedDiskAzureResourceId() {
        return this.managedDiskAzureResourceId;
    }

    /**
     * Set the managedDiskAzureResourceId property: Azure Resource ID of the Managed Disk.
     *
     * @param managedDiskAzureResourceId the managedDiskAzureResourceId value to set.
     * @return the IscsiLun object itself.
     */
    public IscsiLun withManagedDiskAzureResourceId(String managedDiskAzureResourceId) {
        this.managedDiskAzureResourceId = managedDiskAzureResourceId;
        return this;
    }

    /**
     * Get the lun property: Specifies the Logical Unit Number of the iSCSI LUN.
     *
     * @return the lun value.
     */
    public Integer lun() {
        return this.lun;
    }

    /**
     * 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 IscsiLun"));
        }
        if (managedDiskAzureResourceId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property managedDiskAzureResourceId in model IscsiLun"));
        }
    }

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