const Ajv = require('ajv')
const ajv = new Ajv()

class Operation {
  constructor (verb, requestPath, props) {
    const defaultProps = {
      parameters: []
    }
    Object.assign(this, { verb, requestPath }, defaultProps, props)
    return this
  }

  isValid () {
    return ajv.validate(this.schema, this)
  }

  get schema () {
    return require('./operation-schema')
  }
}

module.exports = Operation
