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

/**
 * Rules defining user's geo access within a CDN endpoint.
 *
 */
class GeoFilter {
  /**
   * Create a GeoFilter.
   * @property {string} relativePath Relative path applicable to geo filter.
   * (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.)
   * @property {string} action Action of the geo filter, i.e. allow or block
   * access. Possible values include: 'Block', 'Allow'
   * @property {array} countryCodes Two letter country codes defining user
   * country access in a geo filter, e.g. AU, MX, US.
   */
  constructor() {
  }

  /**
   * Defines the metadata of GeoFilter
   *
   * @returns {object} metadata of GeoFilter
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'GeoFilter',
      type: {
        name: 'Composite',
        className: 'GeoFilter',
        modelProperties: {
          relativePath: {
            required: true,
            serializedName: 'relativePath',
            type: {
              name: 'String'
            }
          },
          action: {
            required: true,
            serializedName: 'action',
            type: {
              name: 'Enum',
              allowedValues: [ 'Block', 'Allow' ]
            }
          },
          countryCodes: {
            required: true,
            serializedName: 'countryCodes',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = GeoFilter;
