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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.networkcloud.models.BmcKeySetDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.BmcKeySetPrivilegeLevel;
import com.azure.resourcemanager.networkcloud.models.BmcKeySetProvisioningState;
import com.azure.resourcemanager.networkcloud.models.KeySetUser;
import com.azure.resourcemanager.networkcloud.models.KeySetUserStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** BmcKeySetProperties represents the properties of baseboard management controller key set. */
@Fluent
public final class BmcKeySetProperties {
    /*
     * The object ID of Azure Active Directory group that all users in the list must be in for access to be granted.
     * Users that are not in the group will not have access.
     */
    @JsonProperty(value = "azureGroupId", required = true)
    private String azureGroupId;

    /*
     * The more detailed status of the key set.
     */
    @JsonProperty(value = "detailedStatus", access = JsonProperty.Access.WRITE_ONLY)
    private BmcKeySetDetailedStatus detailedStatus;

    /*
     * The descriptive message about the current detailed status.
     */
    @JsonProperty(value = "detailedStatusMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String detailedStatusMessage;

    /*
     * The date and time after which the users in this key set will be removed from the baseboard management
     * controllers.
     */
    @JsonProperty(value = "expiration", required = true)
    private OffsetDateTime expiration;

    /*
     * The last time this key set was validated.
     */
    @JsonProperty(value = "lastValidation", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastValidation;

    /*
     * The access level allowed for the users in this key set.
     */
    @JsonProperty(value = "privilegeLevel", required = true)
    private BmcKeySetPrivilegeLevel privilegeLevel;

    /*
     * The provisioning state of the baseboard management controller key set.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private BmcKeySetProvisioningState provisioningState;

    /*
     * The unique list of permitted users.
     */
    @JsonProperty(value = "userList", required = true)
    private List<KeySetUser> userList;

    /*
     * The status evaluation of each user.
     */
    @JsonProperty(value = "userListStatus", access = JsonProperty.Access.WRITE_ONLY)
    private List<KeySetUserStatus> userListStatus;

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

    /**
     * Get the azureGroupId property: The object ID of Azure Active Directory group that all users in the list must be
     * in for access to be granted. Users that are not in the group will not have access.
     *
     * @return the azureGroupId value.
     */
    public String azureGroupId() {
        return this.azureGroupId;
    }

    /**
     * Set the azureGroupId property: The object ID of Azure Active Directory group that all users in the list must be
     * in for access to be granted. Users that are not in the group will not have access.
     *
     * @param azureGroupId the azureGroupId value to set.
     * @return the BmcKeySetProperties object itself.
     */
    public BmcKeySetProperties withAzureGroupId(String azureGroupId) {
        this.azureGroupId = azureGroupId;
        return this;
    }

    /**
     * Get the detailedStatus property: The more detailed status of the key set.
     *
     * @return the detailedStatus value.
     */
    public BmcKeySetDetailedStatus detailedStatus() {
        return this.detailedStatus;
    }

    /**
     * Get the detailedStatusMessage property: The descriptive message about the current detailed status.
     *
     * @return the detailedStatusMessage value.
     */
    public String detailedStatusMessage() {
        return this.detailedStatusMessage;
    }

    /**
     * Get the expiration property: The date and time after which the users in this key set will be removed from the
     * baseboard management controllers.
     *
     * @return the expiration value.
     */
    public OffsetDateTime expiration() {
        return this.expiration;
    }

    /**
     * Set the expiration property: The date and time after which the users in this key set will be removed from the
     * baseboard management controllers.
     *
     * @param expiration the expiration value to set.
     * @return the BmcKeySetProperties object itself.
     */
    public BmcKeySetProperties withExpiration(OffsetDateTime expiration) {
        this.expiration = expiration;
        return this;
    }

    /**
     * Get the lastValidation property: The last time this key set was validated.
     *
     * @return the lastValidation value.
     */
    public OffsetDateTime lastValidation() {
        return this.lastValidation;
    }

    /**
     * Get the privilegeLevel property: The access level allowed for the users in this key set.
     *
     * @return the privilegeLevel value.
     */
    public BmcKeySetPrivilegeLevel privilegeLevel() {
        return this.privilegeLevel;
    }

    /**
     * Set the privilegeLevel property: The access level allowed for the users in this key set.
     *
     * @param privilegeLevel the privilegeLevel value to set.
     * @return the BmcKeySetProperties object itself.
     */
    public BmcKeySetProperties withPrivilegeLevel(BmcKeySetPrivilegeLevel privilegeLevel) {
        this.privilegeLevel = privilegeLevel;
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the baseboard management controller key set.
     *
     * @return the provisioningState value.
     */
    public BmcKeySetProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the userList property: The unique list of permitted users.
     *
     * @return the userList value.
     */
    public List<KeySetUser> userList() {
        return this.userList;
    }

    /**
     * Set the userList property: The unique list of permitted users.
     *
     * @param userList the userList value to set.
     * @return the BmcKeySetProperties object itself.
     */
    public BmcKeySetProperties withUserList(List<KeySetUser> userList) {
        this.userList = userList;
        return this;
    }

    /**
     * Get the userListStatus property: The status evaluation of each user.
     *
     * @return the userListStatus value.
     */
    public List<KeySetUserStatus> userListStatus() {
        return this.userListStatus;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (azureGroupId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property azureGroupId in model BmcKeySetProperties"));
        }
        if (expiration() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property expiration in model BmcKeySetProperties"));
        }
        if (privilegeLevel() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property privilegeLevel in model BmcKeySetProperties"));
        }
        if (userList() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property userList in model BmcKeySetProperties"));
        } else {
            userList().forEach(e -> e.validate());
        }
        if (userListStatus() != null) {
            userListStatus().forEach(e -> e.validate());
        }
    }

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