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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.databoxedge.models.ArmBaseModel;
import com.azure.resourcemanager.databoxedge.models.AsymmetricEncryptedSecret;
import com.azure.resourcemanager.databoxedge.models.ShareAccessRight;
import com.azure.resourcemanager.databoxedge.models.UserType;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Represents a user who has access to one or more shares on the Data Box Edge/Gateway device. */
@Fluent
public final class UserInner extends ArmBaseModel {
    /*
     * The storage account credential properties.
     */
    @JsonProperty(value = "properties", required = true)
    private UserProperties innerProperties = new UserProperties();

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

    /**
     * Get the innerProperties property: The storage account credential properties.
     *
     * @return the innerProperties value.
     */
    private UserProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the encryptedPassword property: The password details.
     *
     * @return the encryptedPassword value.
     */
    public AsymmetricEncryptedSecret encryptedPassword() {
        return this.innerProperties() == null ? null : this.innerProperties().encryptedPassword();
    }

    /**
     * Set the encryptedPassword property: The password details.
     *
     * @param encryptedPassword the encryptedPassword value to set.
     * @return the UserInner object itself.
     */
    public UserInner withEncryptedPassword(AsymmetricEncryptedSecret encryptedPassword) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserProperties();
        }
        this.innerProperties().withEncryptedPassword(encryptedPassword);
        return this;
    }

    /**
     * Get the shareAccessRights property: List of shares that the user has rights on. This field should not be
     * specified during user creation.
     *
     * @return the shareAccessRights value.
     */
    public List<ShareAccessRight> shareAccessRights() {
        return this.innerProperties() == null ? null : this.innerProperties().shareAccessRights();
    }

    /**
     * Set the shareAccessRights property: List of shares that the user has rights on. This field should not be
     * specified during user creation.
     *
     * @param shareAccessRights the shareAccessRights value to set.
     * @return the UserInner object itself.
     */
    public UserInner withShareAccessRights(List<ShareAccessRight> shareAccessRights) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserProperties();
        }
        this.innerProperties().withShareAccessRights(shareAccessRights);
        return this;
    }

    /**
     * Get the userType property: Type of the user.
     *
     * @return the userType value.
     */
    public UserType userType() {
        return this.innerProperties() == null ? null : this.innerProperties().userType();
    }

    /**
     * Set the userType property: Type of the user.
     *
     * @param userType the userType value to set.
     * @return the UserInner object itself.
     */
    public UserInner withUserType(UserType userType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserProperties();
        }
        this.innerProperties().withUserType(userType);
        return this;
    }

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

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