/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 */

package com.microsoft.azure.management.apimanagement.v2019_12_01.implementation;

import com.microsoft.azure.management.apimanagement.v2019_12_01.SubscriptionState;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.azure.ProxyResource;

/**
 * Subscription details.
 */
@JsonFlatten
public class SubscriptionContractInner extends ProxyResource {
    /**
     * The user resource identifier of the subscription owner. The value is a
     * valid relative URL in the format of /users/{userId} where {userId} is a
     * user identifier.
     */
    @JsonProperty(value = "properties.ownerId")
    private String ownerId;

    /**
     * Scope like /products/{productId} or /apis or /apis/{apiId}.
     */
    @JsonProperty(value = "properties.scope", required = true)
    private String scope;

    /**
     * The name of the subscription, or null if the subscription has no name.
     */
    @JsonProperty(value = "properties.displayName")
    private String displayName;

    /**
     * Subscription state. Possible states are * active – the subscription is
     * active, * suspended – the subscription is blocked, and the subscriber
     * cannot call any APIs of the product, * submitted – the subscription
     * request has been made by the developer, but has not yet been approved or
     * rejected, * rejected – the subscription request has been denied by an
     * administrator, * cancelled – the subscription has been cancelled by the
     * developer or administrator, * expired – the subscription reached its
     * expiration date and was deactivated. Possible values include:
     * 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'.
     */
    @JsonProperty(value = "properties.state", required = true)
    private SubscriptionState state;

    /**
     * Subscription creation date. The date conforms to the following format:
     * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     */
    @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY)
    private DateTime createdDate;

    /**
     * Subscription activation date. The setting is for audit purposes only and
     * the subscription is not automatically activated. The subscription
     * lifecycle can be managed by using the `state` property. The date
     * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by
     * the ISO 8601 standard.
     */
    @JsonProperty(value = "properties.startDate")
    private DateTime startDate;

    /**
     * Subscription expiration date. The setting is for audit purposes only and
     * the subscription is not automatically expired. The subscription
     * lifecycle can be managed by using the `state` property. The date
     * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by
     * the ISO 8601 standard.
     */
    @JsonProperty(value = "properties.expirationDate")
    private DateTime expirationDate;

    /**
     * Date when subscription was cancelled or expired. The setting is for
     * audit purposes only and the subscription is not automatically cancelled.
     * The subscription lifecycle can be managed by using the `state` property.
     * The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as
     * specified by the ISO 8601 standard.
     */
    @JsonProperty(value = "properties.endDate")
    private DateTime endDate;

    /**
     * Upcoming subscription expiration notification date. The date conforms to
     * the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO
     * 8601 standard.
     */
    @JsonProperty(value = "properties.notificationDate")
    private DateTime notificationDate;

    /**
     * Subscription primary key. This property will not be filled on 'GET'
     * operations! Use '/listSecrets' POST request to get the value.
     */
    @JsonProperty(value = "properties.primaryKey")
    private String primaryKey;

    /**
     * Subscription secondary key. This property will not be filled on 'GET'
     * operations! Use '/listSecrets' POST request to get the value.
     */
    @JsonProperty(value = "properties.secondaryKey")
    private String secondaryKey;

    /**
     * Optional subscription comment added by an administrator.
     */
    @JsonProperty(value = "properties.stateComment")
    private String stateComment;

    /**
     * Determines whether tracing is enabled.
     */
    @JsonProperty(value = "properties.allowTracing")
    private Boolean allowTracing;

    /**
     * Get the user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
     *
     * @return the ownerId value
     */
    public String ownerId() {
        return this.ownerId;
    }

    /**
     * Set the user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
     *
     * @param ownerId the ownerId value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withOwnerId(String ownerId) {
        this.ownerId = ownerId;
        return this;
    }

    /**
     * Get scope like /products/{productId} or /apis or /apis/{apiId}.
     *
     * @return the scope value
     */
    public String scope() {
        return this.scope;
    }

    /**
     * Set scope like /products/{productId} or /apis or /apis/{apiId}.
     *
     * @param scope the scope value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withScope(String scope) {
        this.scope = scope;
        return this;
    }

    /**
     * Get the name of the subscription, or null if the subscription has no name.
     *
     * @return the displayName value
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the name of the subscription, or null if the subscription has no name.
     *
     * @param displayName the displayName value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'.
     *
     * @return the state value
     */
    public SubscriptionState state() {
        return this.state;
    }

    /**
     * Set subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'.
     *
     * @param state the state value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withState(SubscriptionState state) {
        this.state = state;
        return this;
    }

    /**
     * Get subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the createdDate value
     */
    public DateTime createdDate() {
        return this.createdDate;
    }

    /**
     * Get subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the startDate value
     */
    public DateTime startDate() {
        return this.startDate;
    }

    /**
     * Set subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @param startDate the startDate value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withStartDate(DateTime startDate) {
        this.startDate = startDate;
        return this;
    }

    /**
     * Get subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the expirationDate value
     */
    public DateTime expirationDate() {
        return this.expirationDate;
    }

    /**
     * Set subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @param expirationDate the expirationDate value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withExpirationDate(DateTime expirationDate) {
        this.expirationDate = expirationDate;
        return this;
    }

    /**
     * Get date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the endDate value
     */
    public DateTime endDate() {
        return this.endDate;
    }

    /**
     * Set date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @param endDate the endDate value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withEndDate(DateTime endDate) {
        this.endDate = endDate;
        return this;
    }

    /**
     * Get upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the notificationDate value
     */
    public DateTime notificationDate() {
        return this.notificationDate;
    }

    /**
     * Set upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @param notificationDate the notificationDate value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withNotificationDate(DateTime notificationDate) {
        this.notificationDate = notificationDate;
        return this;
    }

    /**
     * Get subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
     *
     * @return the primaryKey value
     */
    public String primaryKey() {
        return this.primaryKey;
    }

    /**
     * Set subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
     *
     * @param primaryKey the primaryKey value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withPrimaryKey(String primaryKey) {
        this.primaryKey = primaryKey;
        return this;
    }

    /**
     * Get subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
     *
     * @return the secondaryKey value
     */
    public String secondaryKey() {
        return this.secondaryKey;
    }

    /**
     * Set subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
     *
     * @param secondaryKey the secondaryKey value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withSecondaryKey(String secondaryKey) {
        this.secondaryKey = secondaryKey;
        return this;
    }

    /**
     * Get optional subscription comment added by an administrator.
     *
     * @return the stateComment value
     */
    public String stateComment() {
        return this.stateComment;
    }

    /**
     * Set optional subscription comment added by an administrator.
     *
     * @param stateComment the stateComment value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withStateComment(String stateComment) {
        this.stateComment = stateComment;
        return this;
    }

    /**
     * Get determines whether tracing is enabled.
     *
     * @return the allowTracing value
     */
    public Boolean allowTracing() {
        return this.allowTracing;
    }

    /**
     * Set determines whether tracing is enabled.
     *
     * @param allowTracing the allowTracing value to set
     * @return the SubscriptionContractInner object itself.
     */
    public SubscriptionContractInner withAllowTracing(Boolean allowTracing) {
        this.allowTracing = allowTracing;
        return this;
    }

}
