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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Represents a relation between two resources. */
@Fluent
public final class RelationInner extends ResourceWithEtag {
    /*
     * Relation properties
     */
    @JsonProperty(value = "properties")
    private RelationProperties innerProperties;

    /**
     * Get the innerProperties property: Relation properties.
     *
     * @return the innerProperties value.
     */
    private RelationProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public RelationInner withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the relatedResourceId property: The resource ID of the related resource.
     *
     * @return the relatedResourceId value.
     */
    public String relatedResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().relatedResourceId();
    }

    /**
     * Set the relatedResourceId property: The resource ID of the related resource.
     *
     * @param relatedResourceId the relatedResourceId value to set.
     * @return the RelationInner object itself.
     */
    public RelationInner withRelatedResourceId(String relatedResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new RelationProperties();
        }
        this.innerProperties().withRelatedResourceId(relatedResourceId);
        return this;
    }

    /**
     * Get the relatedResourceName property: The name of the related resource.
     *
     * @return the relatedResourceName value.
     */
    public String relatedResourceName() {
        return this.innerProperties() == null ? null : this.innerProperties().relatedResourceName();
    }

    /**
     * Get the relatedResourceType property: The resource type of the related resource.
     *
     * @return the relatedResourceType value.
     */
    public String relatedResourceType() {
        return this.innerProperties() == null ? null : this.innerProperties().relatedResourceType();
    }

    /**
     * Get the relatedResourceKind property: The resource kind of the related resource.
     *
     * @return the relatedResourceKind value.
     */
    public String relatedResourceKind() {
        return this.innerProperties() == null ? null : this.innerProperties().relatedResourceKind();
    }

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