{"size": 1242, "ext": "js", "max_stars_repo_path": "src/models/model.invoice.js", "max_stars_repo_name": "lion-project-management/lpm-billing", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/models/model.invoice.js", "max_issues_repo_name": "lion-project-management/lpm-billing", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/models/model.invoice.js", "max_forks_repo_name": "lion-project-management/lpm-billing", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.5818181818, "max_line_length": 71, "alphanum_fraction": 0.6505636071}
// JSON Schema validation middleware
const Ajv = require('ajv')
const ajv = new Ajv({ allErrors: true })

// JSON Schema for adding a new interface
const generateInvoiceIn = {
  type: 'object',
  properties: {
    clientId: {
      type: 'number'
    },
    billingCycleStart: {
      type: 'string',
      format: 'date-time'
    },
    billingCycleEnd: {
      type: 'string',
      format: 'date-time'
    }
  },
  required: ['clientId', 'billingCycleStart', 'billingCycleEnd']
}
// Compile the JSON validation functions with ajv
const validateGenerateInvoiceIn = ajv.compile(generateInvoiceIn)

// JSON Schema for updating an interface
const updateInvoiceIn = {
  type: 'object',
  properties: {
    _id: {
      type: 'string'
    },
    clientId: {
      type: 'number'
    },
    billingCycleStart: {
      type: 'string',
      format: 'date-time'
    },
    billingCycleEnd: {
      type: 'string',
      format: 'date-time'
    }
  },
  required: ['_id', 'clientId', 'billingCycleStart', 'billingCycleEnd']
}
// Compile the JSON validation functions with ajv
const validateUpdateInvoiceIn = ajv.compile(updateInvoiceIn)

// Export the validation functions
module.exports = {
  validateGenerateInvoiceIn,
  validateUpdateInvoiceIn
}
