// 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.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A class that describes the properties of a SenderUsername resource. */
@Fluent
public final class SenderUsernameProperties {
    /*
     * The location where the SenderUsername resource data is stored at rest.
     */
    @JsonProperty(value = "dataLocation", access = JsonProperty.Access.WRITE_ONLY)
    private String dataLocation;

    /*
     * A sender senderUsername to be used when sending emails.
     */
    @JsonProperty(value = "username", required = true)
    private String username;

    /*
     * The display name for the senderUsername.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * Provisioning state of the resource. Unknown is the default state for Communication Services.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

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

    /**
     * Get the username property: A sender senderUsername to be used when sending emails.
     *
     * @return the username value.
     */
    public String username() {
        return this.username;
    }

    /**
     * Set the username property: A sender senderUsername to be used when sending emails.
     *
     * @param username the username value to set.
     * @return the SenderUsernameProperties object itself.
     */
    public SenderUsernameProperties withUsername(String username) {
        this.username = username;
        return this;
    }

    /**
     * Get the displayName property: The display name for the senderUsername.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name for the senderUsername.
     *
     * @param displayName the displayName value to set.
     * @return the SenderUsernameProperties object itself.
     */
    public SenderUsernameProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the resource. Unknown is the default state for
     * Communication Services.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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