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

package com.azure.resourcemanager.appcontainers.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Custom Domain of a Container App. */
@Fluent
public final class CustomDomain {
    /*
     * Hostname.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Custom Domain binding type.
     */
    @JsonProperty(value = "bindingType")
    private BindingType bindingType;

    /*
     * Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment.
     */
    @JsonProperty(value = "certificateId")
    private String certificateId;

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

    /**
     * Get the name property: Hostname.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Hostname.
     *
     * @param name the name value to set.
     * @return the CustomDomain object itself.
     */
    public CustomDomain withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the bindingType property: Custom Domain binding type.
     *
     * @return the bindingType value.
     */
    public BindingType bindingType() {
        return this.bindingType;
    }

    /**
     * Set the bindingType property: Custom Domain binding type.
     *
     * @param bindingType the bindingType value to set.
     * @return the CustomDomain object itself.
     */
    public CustomDomain withBindingType(BindingType bindingType) {
        this.bindingType = bindingType;
        return this;
    }

    /**
     * Get the certificateId property: Resource Id of the Certificate to be bound to this hostname. Must exist in the
     * Managed Environment.
     *
     * @return the certificateId value.
     */
    public String certificateId() {
        return this.certificateId;
    }

    /**
     * Set the certificateId property: Resource Id of the Certificate to be bound to this hostname. Must exist in the
     * Managed Environment.
     *
     * @param certificateId the certificateId value to set.
     * @return the CustomDomain object itself.
     */
    public CustomDomain withCertificateId(String certificateId) {
        this.certificateId = certificateId;
        return this;
    }

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

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