// 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.Immutable;
import com.azure.resourcemanager.securityinsights.models.EntityCommonProperties;
import com.azure.resourcemanager.securityinsights.models.GeoLocation;
import com.azure.resourcemanager.securityinsights.models.ThreatIntelligence;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Ip entity property bag. */
@Immutable
public final class IpEntityProperties extends EntityCommonProperties {
    /*
     * The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6)
     */
    @JsonProperty(value = "address", access = JsonProperty.Access.WRITE_ONLY)
    private String address;

    /*
     * The geo-location context attached to the ip entity
     */
    @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY)
    private GeoLocation location;

    /*
     * A list of TI contexts attached to the ip entity.
     */
    @JsonProperty(value = "threatIntelligence", access = JsonProperty.Access.WRITE_ONLY)
    private List<ThreatIntelligence> threatIntelligence;

    /**
     * Get the address property: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6).
     *
     * @return the address value.
     */
    public String address() {
        return this.address;
    }

    /**
     * Get the location property: The geo-location context attached to the ip entity.
     *
     * @return the location value.
     */
    public GeoLocation location() {
        return this.location;
    }

    /**
     * Get the threatIntelligence property: A list of TI contexts attached to the ip entity.
     *
     * @return the threatIntelligence value.
     */
    public List<ThreatIntelligence> threatIntelligence() {
        return this.threatIntelligence;
    }

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