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

/**
 * As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18
 *
 */
class JsonWebKey {
  /**
   * Create a JsonWebKey.
   * @member {string} [kid] Key identifier.
   * @member {string} [kty] JsonWebKey Key Type (kty), as defined in
   * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.
   * Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'
   * @member {array} [keyOps]
   * @member {buffer} [n] RSA modulus.
   * @member {buffer} [e] RSA public exponent.
   * @member {buffer} [d] RSA private exponent, or the D component of an EC
   * private key.
   * @member {buffer} [dp] RSA private key parameter.
   * @member {buffer} [dq] RSA private key parameter.
   * @member {buffer} [qi] RSA private key parameter.
   * @member {buffer} [p] RSA secret prime.
   * @member {buffer} [q] RSA secret prime, with p < q.
   * @member {buffer} [k] Symmetric key.
   * @member {buffer} [t] HSM Token, used with 'Bring Your Own Key'.
   * @member {string} [crv] Elliptic curve name. For valid values, see
   * JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521',
   * 'P-256K'
   * @member {buffer} [x] X component of an EC public key.
   * @member {buffer} [y] Y component of an EC public key.
   */
  constructor() {
  }

  /**
   * Defines the metadata of JsonWebKey
   *
   * @returns {object} metadata of JsonWebKey
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'JsonWebKey',
      type: {
        name: 'Composite',
        className: 'JsonWebKey',
        modelProperties: {
          kid: {
            required: false,
            serializedName: 'kid',
            type: {
              name: 'String'
            }
          },
          kty: {
            required: false,
            serializedName: 'kty',
            type: {
              name: 'String'
            }
          },
          keyOps: {
            required: false,
            serializedName: 'key_ops',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          n: {
            required: false,
            serializedName: 'n',
            type: {
              name: 'Base64Url'
            }
          },
          e: {
            required: false,
            serializedName: 'e',
            type: {
              name: 'Base64Url'
            }
          },
          d: {
            required: false,
            serializedName: 'd',
            type: {
              name: 'Base64Url'
            }
          },
          dp: {
            required: false,
            serializedName: 'dp',
            type: {
              name: 'Base64Url'
            }
          },
          dq: {
            required: false,
            serializedName: 'dq',
            type: {
              name: 'Base64Url'
            }
          },
          qi: {
            required: false,
            serializedName: 'qi',
            type: {
              name: 'Base64Url'
            }
          },
          p: {
            required: false,
            serializedName: 'p',
            type: {
              name: 'Base64Url'
            }
          },
          q: {
            required: false,
            serializedName: 'q',
            type: {
              name: 'Base64Url'
            }
          },
          k: {
            required: false,
            serializedName: 'k',
            type: {
              name: 'Base64Url'
            }
          },
          t: {
            required: false,
            serializedName: 'key_hsm',
            type: {
              name: 'Base64Url'
            }
          },
          crv: {
            required: false,
            serializedName: 'crv',
            type: {
              name: 'String'
            }
          },
          x: {
            required: false,
            serializedName: 'x',
            type: {
              name: 'Base64Url'
            }
          },
          y: {
            required: false,
            serializedName: 'y',
            type: {
              name: 'Base64Url'
            }
          }
        }
      }
    };
  }
}

module.exports = JsonWebKey;
