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

/**
 * An Azure SQL Database sync group.
 *
 * @extends models['ProxyResource']
 */
class SyncGroup extends models['ProxyResource'] {
  /**
   * Create a SyncGroup.
   * @property {number} [interval] Sync interval of the sync group.
   * @property {date} [lastSyncTime] Last sync time of the sync group.
   * @property {string} [conflictResolutionPolicy] Conflict resolution policy
   * of the sync group. Possible values include: 'HubWin', 'MemberWin'
   * @property {string} [syncDatabaseId] ARM resource id of the sync database
   * in the sync group.
   * @property {string} [hubDatabaseUserName] User name for the sync group hub
   * database credential.
   * @property {string} [hubDatabasePassword] Password for the sync group hub
   * database credential.
   * @property {string} [syncState] Sync state of the sync group. Possible
   * values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good'
   * @property {object} [schema] Sync schema of the sync group.
   * @property {array} [schema.tables] List of tables in sync group schema.
   * @property {string} [schema.masterSyncMemberName] Name of master sync
   * member where the schema is from.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SyncGroup
   *
   * @returns {object} metadata of SyncGroup
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SyncGroup',
      type: {
        name: 'Composite',
        className: 'SyncGroup',
        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'
            }
          },
          interval: {
            required: false,
            serializedName: 'properties.interval',
            type: {
              name: 'Number'
            }
          },
          lastSyncTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.lastSyncTime',
            type: {
              name: 'DateTime'
            }
          },
          conflictResolutionPolicy: {
            required: false,
            serializedName: 'properties.conflictResolutionPolicy',
            type: {
              name: 'String'
            }
          },
          syncDatabaseId: {
            required: false,
            serializedName: 'properties.syncDatabaseId',
            type: {
              name: 'String'
            }
          },
          hubDatabaseUserName: {
            required: false,
            serializedName: 'properties.hubDatabaseUserName',
            type: {
              name: 'String'
            }
          },
          hubDatabasePassword: {
            required: false,
            serializedName: 'properties.hubDatabasePassword',
            type: {
              name: 'String'
            }
          },
          syncState: {
            required: false,
            readOnly: true,
            serializedName: 'properties.syncState',
            type: {
              name: 'String'
            }
          },
          schema: {
            required: false,
            serializedName: 'properties.schema',
            type: {
              name: 'Composite',
              className: 'SyncGroupSchema'
            }
          }
        }
      }
    };
  }
}

module.exports = SyncGroup;
