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

package com.azure.resourcemanager.security.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Describes properties of an assessment. */
@Fluent
public class SecurityAssessmentPropertiesBase {
    /*
     * Details of the resource that was assessed
     */
    @JsonProperty(value = "resourceDetails", required = true)
    private ResourceDetails resourceDetails;

    /*
     * User friendly display name of the assessment
     */
    @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY)
    private String displayName;

    /*
     * Additional data regarding the assessment
     */
    @JsonProperty(value = "additionalData")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> additionalData;

    /*
     * Links relevant to the assessment
     */
    @JsonProperty(value = "links", access = JsonProperty.Access.WRITE_ONLY)
    private AssessmentLinks links;

    /*
     * Describes properties of an assessment metadata.
     */
    @JsonProperty(value = "metadata")
    private SecurityAssessmentMetadataProperties metadata;

    /*
     * Data regarding 3rd party partner integration
     */
    @JsonProperty(value = "partnersData")
    private SecurityAssessmentPartnerData partnersData;

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

    /**
     * Get the resourceDetails property: Details of the resource that was assessed.
     *
     * @return the resourceDetails value.
     */
    public ResourceDetails resourceDetails() {
        return this.resourceDetails;
    }

    /**
     * Set the resourceDetails property: Details of the resource that was assessed.
     *
     * @param resourceDetails the resourceDetails value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withResourceDetails(ResourceDetails resourceDetails) {
        this.resourceDetails = resourceDetails;
        return this;
    }

    /**
     * Get the displayName property: User friendly display name of the assessment.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Get the additionalData property: Additional data regarding the assessment.
     *
     * @return the additionalData value.
     */
    public Map<String, String> additionalData() {
        return this.additionalData;
    }

    /**
     * Set the additionalData property: Additional data regarding the assessment.
     *
     * @param additionalData the additionalData value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withAdditionalData(Map<String, String> additionalData) {
        this.additionalData = additionalData;
        return this;
    }

    /**
     * Get the links property: Links relevant to the assessment.
     *
     * @return the links value.
     */
    public AssessmentLinks links() {
        return this.links;
    }

    /**
     * Get the metadata property: Describes properties of an assessment metadata.
     *
     * @return the metadata value.
     */
    public SecurityAssessmentMetadataProperties metadata() {
        return this.metadata;
    }

    /**
     * Set the metadata property: Describes properties of an assessment metadata.
     *
     * @param metadata the metadata value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withMetadata(SecurityAssessmentMetadataProperties metadata) {
        this.metadata = metadata;
        return this;
    }

    /**
     * Get the partnersData property: Data regarding 3rd party partner integration.
     *
     * @return the partnersData value.
     */
    public SecurityAssessmentPartnerData partnersData() {
        return this.partnersData;
    }

    /**
     * Set the partnersData property: Data regarding 3rd party partner integration.
     *
     * @param partnersData the partnersData value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withPartnersData(SecurityAssessmentPartnerData partnersData) {
        this.partnersData = partnersData;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (resourceDetails() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property resourceDetails in model SecurityAssessmentPropertiesBase"));
        } else {
            resourceDetails().validate();
        }
        if (links() != null) {
            links().validate();
        }
        if (metadata() != null) {
            metadata().validate();
        }
        if (partnersData() != null) {
            partnersData().validate();
        }
    }

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