// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.security.models.InformationType;
import com.azure.resourcemanager.security.models.SensitivityLabel;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** describes properties of an information protection policy. */
@Fluent
public final class InformationProtectionPolicyProperties {
    /*
     * Describes the last UTC time the policy was modified.
     */
    @JsonProperty(value = "lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModifiedUtc;

    /*
     * Describes the version of the policy.
     */
    @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY)
    private String version;

    /*
     * Dictionary of sensitivity labels.
     */
    @JsonProperty(value = "labels")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, SensitivityLabel> labels;

    /*
     * The sensitivity information types.
     */
    @JsonProperty(value = "informationTypes")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, InformationType> informationTypes;

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

    /**
     * Get the lastModifiedUtc property: Describes the last UTC time the policy was modified.
     *
     * @return the lastModifiedUtc value.
     */
    public OffsetDateTime lastModifiedUtc() {
        return this.lastModifiedUtc;
    }

    /**
     * Get the version property: Describes the version of the policy.
     *
     * @return the version value.
     */
    public String version() {
        return this.version;
    }

    /**
     * Get the labels property: Dictionary of sensitivity labels.
     *
     * @return the labels value.
     */
    public Map<String, SensitivityLabel> labels() {
        return this.labels;
    }

    /**
     * Set the labels property: Dictionary of sensitivity labels.
     *
     * @param labels the labels value to set.
     * @return the InformationProtectionPolicyProperties object itself.
     */
    public InformationProtectionPolicyProperties withLabels(Map<String, SensitivityLabel> labels) {
        this.labels = labels;
        return this;
    }

    /**
     * Get the informationTypes property: The sensitivity information types.
     *
     * @return the informationTypes value.
     */
    public Map<String, InformationType> informationTypes() {
        return this.informationTypes;
    }

    /**
     * Set the informationTypes property: The sensitivity information types.
     *
     * @param informationTypes the informationTypes value to set.
     * @return the InformationProtectionPolicyProperties object itself.
     */
    public InformationProtectionPolicyProperties withInformationTypes(Map<String, InformationType> informationTypes) {
        this.informationTypes = informationTypes;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (labels() != null) {
            labels()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
        if (informationTypes() != null) {
            informationTypes()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
    }
}
