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

/**
 * Class representing a OcrResult.
 */
class OcrResult {
  /**
   * Create a OcrResult.
   * @property {string} [language] The BCP-47 language code of the text in the
   * image.
   * @property {number} [textAngle] The angle, in degrees, of the detected text
   * with respect to the closest horizontal or vertical direction. After
   * rotating the input image clockwise by this angle, the recognized text
   * lines become horizontal or vertical. In combination with the orientation
   * property it can be used to overlay recognition results correctly on the
   * original image, by rotating either the original image or recognition
   * results by a suitable angle around the center of the original image. If
   * the angle cannot be confidently detected, this property is not present. If
   * the image contains text at different angles, only part of the text will be
   * recognized correctly.
   * @property {string} [orientation] Orientation of the text recognized in the
   * image. The value (up, down, left, or right) refers to the direction that
   * the top of the recognized text is facing, after the image has been rotated
   * around its center according to the detected text angle (see textAngle
   * property).
   * @property {array} [regions] An array of objects, where each object
   * represents a region of recognized text.
   */
  constructor() {
  }

  /**
   * Defines the metadata of OcrResult
   *
   * @returns {object} metadata of OcrResult
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'OcrResult',
      type: {
        name: 'Composite',
        className: 'OcrResult',
        modelProperties: {
          language: {
            required: false,
            nullable: true,
            serializedName: 'language',
            type: {
              name: 'String'
            }
          },
          textAngle: {
            required: false,
            nullable: false,
            serializedName: 'textAngle',
            type: {
              name: 'Number'
            }
          },
          orientation: {
            required: false,
            nullable: true,
            serializedName: 'orientation',
            type: {
              name: 'String'
            }
          },
          regions: {
            required: false,
            nullable: true,
            serializedName: 'regions',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'OcrRegionElementType',
                  type: {
                    name: 'Composite',
                    className: 'OcrRegion'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = OcrResult;
