// 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.core.management.ProxyResource;
import com.azure.resourcemanager.security.models.SecurityContactPropertiesAlertNotifications;
import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Contact details and configurations for notifications coming from Microsoft Defender for Cloud. */
@Fluent
public final class SecurityContactInner extends ProxyResource {
    /*
     * Security contact data
     */
    @JsonProperty(value = "properties")
    private SecurityContactProperties innerProperties;

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

    /**
     * Get the innerProperties property: Security contact data.
     *
     * @return the innerProperties value.
     */
    private SecurityContactProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud
     * by the configurations defined in this security contact.
     *
     * @return the emails value.
     */
    public String emails() {
        return this.innerProperties() == null ? null : this.innerProperties().emails();
    }

    /**
     * Set the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud
     * by the configurations defined in this security contact.
     *
     * @param emails the emails value to set.
     * @return the SecurityContactInner object itself.
     */
    public SecurityContactInner withEmails(String emails) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SecurityContactProperties();
        }
        this.innerProperties().withEmails(emails);
        return this;
    }

    /**
     * Get the phone property: The security contact's phone number.
     *
     * @return the phone value.
     */
    public String phone() {
        return this.innerProperties() == null ? null : this.innerProperties().phone();
    }

    /**
     * Set the phone property: The security contact's phone number.
     *
     * @param phone the phone value to set.
     * @return the SecurityContactInner object itself.
     */
    public SecurityContactInner withPhone(String phone) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SecurityContactProperties();
        }
        this.innerProperties().withPhone(phone);
        return this;
    }

    /**
     * Get the alertNotifications property: Defines whether to send email notifications about new security alerts.
     *
     * @return the alertNotifications value.
     */
    public SecurityContactPropertiesAlertNotifications alertNotifications() {
        return this.innerProperties() == null ? null : this.innerProperties().alertNotifications();
    }

    /**
     * Set the alertNotifications property: Defines whether to send email notifications about new security alerts.
     *
     * @param alertNotifications the alertNotifications value to set.
     * @return the SecurityContactInner object itself.
     */
    public SecurityContactInner withAlertNotifications(SecurityContactPropertiesAlertNotifications alertNotifications) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SecurityContactProperties();
        }
        this.innerProperties().withAlertNotifications(alertNotifications);
        return this;
    }

    /**
     * Get the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for
     * Cloud to persons with specific RBAC roles on the subscription.
     *
     * @return the notificationsByRole value.
     */
    public SecurityContactPropertiesNotificationsByRole notificationsByRole() {
        return this.innerProperties() == null ? null : this.innerProperties().notificationsByRole();
    }

    /**
     * Set the notificationsByRole property: Defines whether to send email notifications from Microsoft Defender for
     * Cloud to persons with specific RBAC roles on the subscription.
     *
     * @param notificationsByRole the notificationsByRole value to set.
     * @return the SecurityContactInner object itself.
     */
    public SecurityContactInner withNotificationsByRole(
        SecurityContactPropertiesNotificationsByRole notificationsByRole) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SecurityContactProperties();
        }
        this.innerProperties().withNotificationsByRole(notificationsByRole);
        return this;
    }

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