/*
 * 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.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const models = require('./index');

/**
 * Subscription details.
 *
 * @extends models['Resource']
 */
class SubscriptionContract extends models['Resource'] {
  /**
   * Create a SubscriptionContract.
   * @property {string} [ownerId] 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.
   * @property {string} scope Scope like /products/{productId} or /apis or
   * /apis/{apiId}.
   * @property {string} [displayName] The name of the subscription, or null if
   * the subscription has no name.
   * @property {string} state 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'
   * @property {date} [createdDate] Subscription creation date. The date
   * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by
   * the ISO 8601 standard.
   * @property {date} [startDate] 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.
   * @property {date} [expirationDate] 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.
   * @property {date} [endDate] 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.
   * @property {date} [notificationDate] Upcoming subscription expiration
   * notification date. The date conforms to the following format:
   * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
   * @property {string} [primaryKey] Subscription primary key. This property
   * will not be filled on 'GET' operations! Use '/listSecrets' POST request to
   * get the value.
   * @property {string} [secondaryKey] Subscription secondary key. This
   * property will not be filled on 'GET' operations! Use '/listSecrets' POST
   * request to get the value.
   * @property {string} [stateComment] Optional subscription comment added by
   * an administrator when the state is changed to the 'rejected'.
   * @property {boolean} [allowTracing] Determines whether tracing is enabled
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SubscriptionContract
   *
   * @returns {object} metadata of SubscriptionContract
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SubscriptionContract',
      type: {
        name: 'Composite',
        className: 'SubscriptionContract',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          ownerId: {
            required: false,
            serializedName: 'properties.ownerId',
            type: {
              name: 'String'
            }
          },
          scope: {
            required: true,
            serializedName: 'properties.scope',
            type: {
              name: 'String'
            }
          },
          displayName: {
            required: false,
            serializedName: 'properties.displayName',
            constraints: {
              MaxLength: 100,
              MinLength: 0
            },
            type: {
              name: 'String'
            }
          },
          state: {
            required: true,
            serializedName: 'properties.state',
            type: {
              name: 'Enum',
              allowedValues: [ 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled' ]
            }
          },
          createdDate: {
            required: false,
            readOnly: true,
            serializedName: 'properties.createdDate',
            type: {
              name: 'DateTime'
            }
          },
          startDate: {
            required: false,
            serializedName: 'properties.startDate',
            type: {
              name: 'DateTime'
            }
          },
          expirationDate: {
            required: false,
            serializedName: 'properties.expirationDate',
            type: {
              name: 'DateTime'
            }
          },
          endDate: {
            required: false,
            serializedName: 'properties.endDate',
            type: {
              name: 'DateTime'
            }
          },
          notificationDate: {
            required: false,
            serializedName: 'properties.notificationDate',
            type: {
              name: 'DateTime'
            }
          },
          primaryKey: {
            required: false,
            serializedName: 'properties.primaryKey',
            constraints: {
              MaxLength: 256,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          secondaryKey: {
            required: false,
            serializedName: 'properties.secondaryKey',
            constraints: {
              MaxLength: 256,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          stateComment: {
            required: false,
            serializedName: 'properties.stateComment',
            type: {
              name: 'String'
            }
          },
          allowTracing: {
            required: false,
            serializedName: 'properties.allowTracing',
            type: {
              name: 'Boolean'
            }
          }
        }
      }
    };
  }
}

module.exports = SubscriptionContract;
