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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.communication.models.DomainManagement;
import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationRecords;
import com.azure.resourcemanager.communication.models.DomainPropertiesVerificationStates;
import com.azure.resourcemanager.communication.models.DomainsProvisioningState;
import com.azure.resourcemanager.communication.models.UserEngagementTracking;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A class that describes the properties of a Domains resource. */
@Fluent
public final class DomainProperties {
    /*
     * Provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private DomainsProvisioningState provisioningState;

    /*
     * The location where the Domains resource data is stored at rest.
     */
    @JsonProperty(value = "dataLocation", access = JsonProperty.Access.WRITE_ONLY)
    private String dataLocation;

    /*
     * P2 sender domain that is displayed to the email recipients [RFC 5322].
     */
    @JsonProperty(value = "fromSenderDomain", access = JsonProperty.Access.WRITE_ONLY)
    private String fromSenderDomain;

    /*
     * P1 sender domain that is present on the email envelope [RFC 5321].
     */
    @JsonProperty(value = "mailFromSenderDomain", access = JsonProperty.Access.WRITE_ONLY)
    private String mailFromSenderDomain;

    /*
     * Describes how a Domains resource is being managed.
     */
    @JsonProperty(value = "domainManagement", required = true)
    private DomainManagement domainManagement;

    /*
     * List of VerificationStatusRecord
     */
    @JsonProperty(value = "verificationStates", access = JsonProperty.Access.WRITE_ONLY)
    private DomainPropertiesVerificationStates verificationStates;

    /*
     * List of DnsRecord
     */
    @JsonProperty(value = "verificationRecords", access = JsonProperty.Access.WRITE_ONLY)
    private DomainPropertiesVerificationRecords verificationRecords;

    /*
     * Describes whether user engagement tracking is enabled or disabled.
     */
    @JsonProperty(value = "userEngagementTracking")
    private UserEngagementTracking userEngagementTracking;

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

    /**
     * Get the provisioningState property: Provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public DomainsProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the dataLocation property: The location where the Domains resource data is stored at rest.
     *
     * @return the dataLocation value.
     */
    public String dataLocation() {
        return this.dataLocation;
    }

    /**
     * Get the fromSenderDomain property: P2 sender domain that is displayed to the email recipients [RFC 5322].
     *
     * @return the fromSenderDomain value.
     */
    public String fromSenderDomain() {
        return this.fromSenderDomain;
    }

    /**
     * Get the mailFromSenderDomain property: P1 sender domain that is present on the email envelope [RFC 5321].
     *
     * @return the mailFromSenderDomain value.
     */
    public String mailFromSenderDomain() {
        return this.mailFromSenderDomain;
    }

    /**
     * Get the domainManagement property: Describes how a Domains resource is being managed.
     *
     * @return the domainManagement value.
     */
    public DomainManagement domainManagement() {
        return this.domainManagement;
    }

    /**
     * Set the domainManagement property: Describes how a Domains resource is being managed.
     *
     * @param domainManagement the domainManagement value to set.
     * @return the DomainProperties object itself.
     */
    public DomainProperties withDomainManagement(DomainManagement domainManagement) {
        this.domainManagement = domainManagement;
        return this;
    }

    /**
     * Get the verificationStates property: List of VerificationStatusRecord.
     *
     * @return the verificationStates value.
     */
    public DomainPropertiesVerificationStates verificationStates() {
        return this.verificationStates;
    }

    /**
     * Get the verificationRecords property: List of DnsRecord.
     *
     * @return the verificationRecords value.
     */
    public DomainPropertiesVerificationRecords verificationRecords() {
        return this.verificationRecords;
    }

    /**
     * Get the userEngagementTracking property: Describes whether user engagement tracking is enabled or disabled.
     *
     * @return the userEngagementTracking value.
     */
    public UserEngagementTracking userEngagementTracking() {
        return this.userEngagementTracking;
    }

    /**
     * Set the userEngagementTracking property: Describes whether user engagement tracking is enabled or disabled.
     *
     * @param userEngagementTracking the userEngagementTracking value to set.
     * @return the DomainProperties object itself.
     */
    public DomainProperties withUserEngagementTracking(UserEngagementTracking userEngagementTracking) {
        this.userEngagementTracking = userEngagementTracking;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (domainManagement() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property domainManagement in model DomainProperties"));
        }
        if (verificationStates() != null) {
            verificationStates().validate();
        }
        if (verificationRecords() != null) {
            verificationRecords().validate();
        }
    }

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