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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.labservices.models.InvitationState;
import com.azure.resourcemanager.labservices.models.ProvisioningState;
import com.azure.resourcemanager.labservices.models.RegistrationState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.Duration;
import java.time.OffsetDateTime;

/** User of a lab that can register for and use virtual machines within the lab. */
@Fluent
public final class UserInner extends ProxyResource {
    /*
     * Metadata pertaining to creation and last modification of the user resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * User resource properties
     */
    @JsonProperty(value = "properties", required = true)
    private UserProperties innerProperties = new UserProperties();

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the user resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: User resource properties.
     *
     * @return the innerProperties value.
     */
    private UserProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the provisioningState property: Current provisioning state of the user resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the displayName property: Display name of the user, for example user's full name.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Get the email property: Email address of the user.
     *
     * @return the email value.
     */
    public String email() {
        return this.innerProperties() == null ? null : this.innerProperties().email();
    }

    /**
     * Set the email property: Email address of the user.
     *
     * @param email the email value to set.
     * @return the UserInner object itself.
     */
    public UserInner withEmail(String email) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserProperties();
        }
        this.innerProperties().withEmail(email);
        return this;
    }

    /**
     * Get the registrationState property: State of the user's registration within the lab.
     *
     * @return the registrationState value.
     */
    public RegistrationState registrationState() {
        return this.innerProperties() == null ? null : this.innerProperties().registrationState();
    }

    /**
     * Get the invitationState property: State of the invitation message for the user.
     *
     * @return the invitationState value.
     */
    public InvitationState invitationState() {
        return this.innerProperties() == null ? null : this.innerProperties().invitationState();
    }

    /**
     * Get the invitationSent property: Date and time when the invitation message was sent to the user.
     *
     * @return the invitationSent value.
     */
    public OffsetDateTime invitationSent() {
        return this.innerProperties() == null ? null : this.innerProperties().invitationSent();
    }

    /**
     * Get the totalUsage property: How long the user has used their virtual machines in this lab.
     *
     * @return the totalUsage value.
     */
    public Duration totalUsage() {
        return this.innerProperties() == null ? null : this.innerProperties().totalUsage();
    }

    /**
     * Get the additionalUsageQuota property: The amount of usage quota time the user gets in addition to the lab usage
     * quota.
     *
     * @return the additionalUsageQuota value.
     */
    public Duration additionalUsageQuota() {
        return this.innerProperties() == null ? null : this.innerProperties().additionalUsageQuota();
    }

    /**
     * Set the additionalUsageQuota property: The amount of usage quota time the user gets in addition to the lab usage
     * quota.
     *
     * @param additionalUsageQuota the additionalUsageQuota value to set.
     * @return the UserInner object itself.
     */
    public UserInner withAdditionalUsageQuota(Duration additionalUsageQuota) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserProperties();
        }
        this.innerProperties().withAdditionalUsageQuota(additionalUsageQuota);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void 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);
}
