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

/**
 * Represents a database recommended index.
 *
 * @extends models['ProxyResource']
 */
class RecommendedIndex extends models['ProxyResource'] {
  /**
   * Create a RecommendedIndex.
   * @property {string} [action] The proposed index action. You can create a
   * missing index, drop an unused index, or rebuild an existing index to
   * improve its performance. Possible values include: 'Create', 'Drop',
   * 'Rebuild'
   * @property {string} [state] The current recommendation state. Possible
   * values include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending
   * Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked',
   * 'Success'
   * @property {date} [created] The UTC datetime showing when this resource was
   * created (ISO8601 format).
   * @property {date} [lastModified] The UTC datetime of when was this resource
   * last changed (ISO8601 format).
   * @property {string} [indexType] The type of index (CLUSTERED, NONCLUSTERED,
   * COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED',
   * 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'
   * @property {string} [schema] The schema where table to build index over
   * resides
   * @property {string} [table] The table on which to build index.
   * @property {array} [columns] Columns over which to build index
   * @property {array} [includedColumns] The list of column names to be
   * included in the index
   * @property {string} [indexScript] The full build index script
   * @property {array} [estimatedImpact] The estimated impact of doing
   * recommended index action.
   * @property {array} [reportedImpact] The values reported after index action
   * is complete.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of RecommendedIndex
   *
   * @returns {object} metadata of RecommendedIndex
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'RecommendedIndex',
      type: {
        name: 'Composite',
        className: 'RecommendedIndex',
        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'
            }
          },
          action: {
            required: false,
            readOnly: true,
            serializedName: 'properties.action',
            type: {
              name: 'Enum',
              allowedValues: [ 'Create', 'Drop', 'Rebuild' ]
            }
          },
          state: {
            required: false,
            readOnly: true,
            serializedName: 'properties.state',
            type: {
              name: 'Enum',
              allowedValues: [ 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' ]
            }
          },
          created: {
            required: false,
            readOnly: true,
            serializedName: 'properties.created',
            type: {
              name: 'DateTime'
            }
          },
          lastModified: {
            required: false,
            readOnly: true,
            serializedName: 'properties.lastModified',
            type: {
              name: 'DateTime'
            }
          },
          indexType: {
            required: false,
            readOnly: true,
            serializedName: 'properties.indexType',
            type: {
              name: 'Enum',
              allowedValues: [ 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE' ]
            }
          },
          schema: {
            required: false,
            readOnly: true,
            serializedName: 'properties.schema',
            type: {
              name: 'String'
            }
          },
          table: {
            required: false,
            readOnly: true,
            serializedName: 'properties.table',
            type: {
              name: 'String'
            }
          },
          columns: {
            required: false,
            readOnly: true,
            serializedName: 'properties.columns',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          includedColumns: {
            required: false,
            readOnly: true,
            serializedName: 'properties.includedColumns',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          indexScript: {
            required: false,
            readOnly: true,
            serializedName: 'properties.indexScript',
            type: {
              name: 'String'
            }
          },
          estimatedImpact: {
            required: false,
            readOnly: true,
            serializedName: 'properties.estimatedImpact',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'OperationImpactElementType',
                  type: {
                    name: 'Composite',
                    className: 'OperationImpact'
                  }
              }
            }
          },
          reportedImpact: {
            required: false,
            readOnly: true,
            serializedName: 'properties.reportedImpact',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'OperationImpactElementType',
                  type: {
                    name: 'Composite',
                    className: 'OperationImpact'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = RecommendedIndex;
