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

package com.azure.resourcemanager.devcenter.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.devcenter.fluent.models.ProjectEnvironmentTypeUpdateProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/**
 * The project environment type for partial update. Properties not provided in the update request will not be changed.
 */
@Fluent
public final class ProjectEnvironmentTypeUpdate {
    /*
     * Properties to configure an environment type.
     */
    @JsonProperty(value = "properties")
    private ProjectEnvironmentTypeUpdateProperties innerProperties;

    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * Managed identity properties
     */
    @JsonProperty(value = "identity")
    private ManagedServiceIdentity identity;

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

    /**
     * Get the innerProperties property: Properties to configure an environment type.
     *
     * @return the innerProperties value.
     */
    private ProjectEnvironmentTypeUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the identity property: Managed identity properties.
     *
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed identity properties.
     *
     * @param identity the identity value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The
     * environment's resources will be deployed into this subscription.
     *
     * @return the deploymentTargetId value.
     */
    public String deploymentTargetId() {
        return this.innerProperties() == null ? null : this.innerProperties().deploymentTargetId();
    }

    /**
     * Set the deploymentTargetId property: Id of a subscription that the environment type will be mapped to. The
     * environment's resources will be deployed into this subscription.
     *
     * @param deploymentTargetId the deploymentTargetId value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withDeploymentTargetId(String deploymentTargetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ProjectEnvironmentTypeUpdateProperties();
        }
        this.innerProperties().withDeploymentTargetId(deploymentTargetId);
        return this;
    }

    /**
     * Get the status property: Defines whether this Environment Type can be used in this Project.
     *
     * @return the status value.
     */
    public EnvironmentTypeEnableStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Defines whether this Environment Type can be used in this Project.
     *
     * @param status the status value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withStatus(EnvironmentTypeEnableStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ProjectEnvironmentTypeUpdateProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the creatorRoleAssignment property: The role definition assigned to the environment creator on backing
     * resources.
     *
     * @return the creatorRoleAssignment value.
     */
    public ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment() {
        return this.innerProperties() == null ? null : this.innerProperties().creatorRoleAssignment();
    }

    /**
     * Set the creatorRoleAssignment property: The role definition assigned to the environment creator on backing
     * resources.
     *
     * @param creatorRoleAssignment the creatorRoleAssignment value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withCreatorRoleAssignment(
        ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment creatorRoleAssignment) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ProjectEnvironmentTypeUpdateProperties();
        }
        this.innerProperties().withCreatorRoleAssignment(creatorRoleAssignment);
        return this;
    }

    /**
     * Get the userRoleAssignments property: Role Assignments created on environment backing resources. This is a
     * mapping from a user object ID to an object of role definition IDs.
     *
     * @return the userRoleAssignments value.
     */
    public Map<String, UserRoleAssignmentValue> userRoleAssignments() {
        return this.innerProperties() == null ? null : this.innerProperties().userRoleAssignments();
    }

    /**
     * Set the userRoleAssignments property: Role Assignments created on environment backing resources. This is a
     * mapping from a user object ID to an object of role definition IDs.
     *
     * @param userRoleAssignments the userRoleAssignments value to set.
     * @return the ProjectEnvironmentTypeUpdate object itself.
     */
    public ProjectEnvironmentTypeUpdate withUserRoleAssignments(
        Map<String, UserRoleAssignmentValue> userRoleAssignments) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ProjectEnvironmentTypeUpdateProperties();
        }
        this.innerProperties().withUserRoleAssignments(userRoleAssignments);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }
}
