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

package com.azure.resourcemanager.machinelearningservices.models;

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

/** A user that can be assigned to a compute instance. */
@Fluent
public final class AssignedUser {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(AssignedUser.class);

    /*
     * User’s AAD Object Id.
     */
    @JsonProperty(value = "objectId", required = true)
    private String objectId;

    /*
     * User’s AAD Tenant Id.
     */
    @JsonProperty(value = "tenantId", required = true)
    private String tenantId;

    /**
     * Get the objectId property: User’s AAD Object Id.
     *
     * @return the objectId value.
     */
    public String objectId() {
        return this.objectId;
    }

    /**
     * Set the objectId property: User’s AAD Object Id.
     *
     * @param objectId the objectId value to set.
     * @return the AssignedUser object itself.
     */
    public AssignedUser withObjectId(String objectId) {
        this.objectId = objectId;
        return this;
    }

    /**
     * Get the tenantId property: User’s AAD Tenant Id.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Set the tenantId property: User’s AAD Tenant Id.
     *
     * @param tenantId the tenantId value to set.
     * @return the AssignedUser object itself.
     */
    public AssignedUser withTenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (objectId() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property objectId in model AssignedUser"));
        }
        if (tenantId() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property tenantId in model AssignedUser"));
        }
    }
}
