/*
 * 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';

/**
 * A failover group update request.
 *
 */
class FailoverGroupUpdate {
  /**
   * Create a FailoverGroupUpdate.
   * @property {object} [readWriteEndpoint] Read-write endpoint of the failover
   * group instance.
   * @property {string} [readWriteEndpoint.failoverPolicy] Failover policy of
   * the read-write endpoint for the failover group. If failoverPolicy is
   * Automatic then failoverWithDataLossGracePeriodMinutes is required.
   * Possible values include: 'Manual', 'Automatic'
   * @property {number}
   * [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace period
   * before failover with data loss is attempted for the read-write endpoint.
   * If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes
   * is required.
   * @property {object} [readOnlyEndpoint] Read-only endpoint of the failover
   * group instance.
   * @property {string} [readOnlyEndpoint.failoverPolicy] Failover policy of
   * the read-only endpoint for the failover group. Possible values include:
   * 'Disabled', 'Enabled'
   * @property {array} [databases] List of databases in the failover group.
   * @property {object} [tags] Resource tags.
   */
  constructor() {
  }

  /**
   * Defines the metadata of FailoverGroupUpdate
   *
   * @returns {object} metadata of FailoverGroupUpdate
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'FailoverGroupUpdate',
      type: {
        name: 'Composite',
        className: 'FailoverGroupUpdate',
        modelProperties: {
          readWriteEndpoint: {
            required: false,
            serializedName: 'properties.readWriteEndpoint',
            type: {
              name: 'Composite',
              className: 'FailoverGroupReadWriteEndpoint'
            }
          },
          readOnlyEndpoint: {
            required: false,
            serializedName: 'properties.readOnlyEndpoint',
            type: {
              name: 'Composite',
              className: 'FailoverGroupReadOnlyEndpoint'
            }
          },
          databases: {
            required: false,
            serializedName: 'properties.databases',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          tags: {
            required: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = FailoverGroupUpdate;
