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

package com.azure.resourcemanager.notificationhubs.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.notificationhubs.fluent.models.ApnsCredentialProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Description of a NotificationHub ApnsCredential. */
@Fluent
public final class ApnsCredential {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ApnsCredential.class);

    /*
     * Properties of NotificationHub ApnsCredential.
     */
    @JsonProperty(value = "properties")
    private ApnsCredentialProperties innerProperties;

    /**
     * Get the innerProperties property: Properties of NotificationHub ApnsCredential.
     *
     * @return the innerProperties value.
     */
    private ApnsCredentialProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode.
     *
     * @return the apnsCertificate value.
     */
    public String apnsCertificate() {
        return this.innerProperties() == null ? null : this.innerProperties().apnsCertificate();
    }

    /**
     * Set the apnsCertificate property: The APNS certificate. Specify if using Certificate Authentication Mode.
     *
     * @param apnsCertificate the apnsCertificate value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withApnsCertificate(String apnsCertificate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withApnsCertificate(apnsCertificate);
        return this;
    }

    /**
     * Get the certificateKey property: The APNS certificate password if it exists.
     *
     * @return the certificateKey value.
     */
    public String certificateKey() {
        return this.innerProperties() == null ? null : this.innerProperties().certificateKey();
    }

    /**
     * Set the certificateKey property: The APNS certificate password if it exists.
     *
     * @param certificateKey the certificateKey value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withCertificateKey(String certificateKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withCertificateKey(certificateKey);
        return this;
    }

    /**
     * Get the endpoint property: The APNS endpoint of this credential. If using Certificate Authentication Mode and
     * Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify
     * 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify
     * 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify
     * 'https://api.push.apple.com:443/3/device'.
     *
     * @return the endpoint value.
     */
    public String endpoint() {
        return this.innerProperties() == null ? null : this.innerProperties().endpoint();
    }

    /**
     * Set the endpoint property: The APNS endpoint of this credential. If using Certificate Authentication Mode and
     * Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify
     * 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify
     * 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify
     * 'https://api.push.apple.com:443/3/device'.
     *
     * @param endpoint the endpoint value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withEndpoint(String endpoint) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withEndpoint(endpoint);
        return this;
    }

    /**
     * Get the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode.
     *
     * @return the thumbprint value.
     */
    public String thumbprint() {
        return this.innerProperties() == null ? null : this.innerProperties().thumbprint();
    }

    /**
     * Set the thumbprint property: The APNS certificate thumbprint. Specify if using Certificate Authentication Mode.
     *
     * @param thumbprint the thumbprint value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withThumbprint(String thumbprint) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withThumbprint(thumbprint);
        return this;
    }

    /**
     * Get the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if
     * using Token Authentication Mode.
     *
     * @return the keyId value.
     */
    public String keyId() {
        return this.innerProperties() == null ? null : this.innerProperties().keyId();
    }

    /**
     * Set the keyId property: A 10-character key identifier (kid) key, obtained from your developer account. Specify if
     * using Token Authentication Mode.
     *
     * @param keyId the keyId value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withKeyId(String keyId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withKeyId(keyId);
        return this;
    }

    /**
     * Get the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode.
     *
     * @return the appName value.
     */
    public String appName() {
        return this.innerProperties() == null ? null : this.innerProperties().appName();
    }

    /**
     * Set the appName property: The name of the application or BundleId. Specify if using Token Authentication Mode.
     *
     * @param appName the appName value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withAppName(String appName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withAppName(appName);
        return this;
    }

    /**
     * Get the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from
     * your developer account. Specify if using Token Authentication Mode.
     *
     * @return the appId value.
     */
    public String appId() {
        return this.innerProperties() == null ? null : this.innerProperties().appId();
    }

    /**
     * Set the appId property: The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from
     * your developer account. Specify if using Token Authentication Mode.
     *
     * @param appId the appId value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withAppId(String appId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withAppId(appId);
        return this;
    }

    /**
     * Get the token property: Provider Authentication Token, obtained through your developer account. Specify if using
     * Token Authentication Mode.
     *
     * @return the token value.
     */
    public String token() {
        return this.innerProperties() == null ? null : this.innerProperties().token();
    }

    /**
     * Set the token property: Provider Authentication Token, obtained through your developer account. Specify if using
     * Token Authentication Mode.
     *
     * @param token the token value to set.
     * @return the ApnsCredential object itself.
     */
    public ApnsCredential withToken(String token) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApnsCredentialProperties();
        }
        this.innerProperties().withToken(token);
        return this;
    }

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