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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagepool.models.Acl;
import com.azure.resourcemanager.storagepool.models.IscsiLun;
import com.azure.resourcemanager.storagepool.models.IscsiTargetAclMode;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Properties for iSCSI Target create or update request. */
@Fluent
public final class IscsiTargetCreateProperties {
    /*
     * Mode for Target connectivity.
     */
    @JsonProperty(value = "aclMode", required = true)
    private IscsiTargetAclMode aclMode;

    /*
     * iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     */
    @JsonProperty(value = "targetIqn")
    private String targetIqn;

    /*
     * Access Control List (ACL) for an iSCSI Target; defines LUN masking policy
     */
    @JsonProperty(value = "staticAcls")
    private List<Acl> staticAcls;

    /*
     * List of LUNs to be exposed through iSCSI Target.
     */
    @JsonProperty(value = "luns")
    private List<IscsiLun> luns;

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

    /**
     * Get the aclMode property: Mode for Target connectivity.
     *
     * @return the aclMode value.
     */
    public IscsiTargetAclMode aclMode() {
        return this.aclMode;
    }

    /**
     * Set the aclMode property: Mode for Target connectivity.
     *
     * @param aclMode the aclMode value to set.
     * @return the IscsiTargetCreateProperties object itself.
     */
    public IscsiTargetCreateProperties withAclMode(IscsiTargetAclMode aclMode) {
        this.aclMode = aclMode;
        return this;
    }

    /**
     * Get the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     *
     * @return the targetIqn value.
     */
    public String targetIqn() {
        return this.targetIqn;
    }

    /**
     * Set the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     *
     * @param targetIqn the targetIqn value to set.
     * @return the IscsiTargetCreateProperties object itself.
     */
    public IscsiTargetCreateProperties withTargetIqn(String targetIqn) {
        this.targetIqn = targetIqn;
        return this;
    }

    /**
     * Get the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     *
     * @return the staticAcls value.
     */
    public List<Acl> staticAcls() {
        return this.staticAcls;
    }

    /**
     * Set the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     *
     * @param staticAcls the staticAcls value to set.
     * @return the IscsiTargetCreateProperties object itself.
     */
    public IscsiTargetCreateProperties withStaticAcls(List<Acl> staticAcls) {
        this.staticAcls = staticAcls;
        return this;
    }

    /**
     * Get the luns property: List of LUNs to be exposed through iSCSI Target.
     *
     * @return the luns value.
     */
    public List<IscsiLun> luns() {
        return this.luns;
    }

    /**
     * Set the luns property: List of LUNs to be exposed through iSCSI Target.
     *
     * @param luns the luns value to set.
     * @return the IscsiTargetCreateProperties object itself.
     */
    public IscsiTargetCreateProperties withLuns(List<IscsiLun> luns) {
        this.luns = luns;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (aclMode() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property aclMode in model IscsiTargetCreateProperties"));
        }
        if (staticAcls() != null) {
            staticAcls().forEach(e -> e.validate());
        }
        if (luns() != null) {
            luns().forEach(e -> e.validate());
        }
    }

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