text: const Joi = require('joi')
  const User = require('./domain')
  
  module.exports = {
    // GET /users
    listUsers: {
      query: {
        page: Joi.number().min(1),
        perPage: Joi.number().min(1).max(100),
        email: Joi.string(),
        role: Joi.string().valid('user', 'admin')
      }
    },
  
    // POST /users
    createUser: {
      body: {
        email: Joi.string().email().required(),
        password: Joi.string().min(6).max(128).required(),
        role: Joi.string().valid('user', 'admin')
      }
    },
  
    // PUT /users/:userId
    replaceUser: {
      body: {
        email: Joi.string().email().required(),
        password: Joi.string().min(6).max(128).required(),
        role: Joi.string().valid('user', 'admin')
      },
      params: {
        userId: Joi.string()
          .regex(/^[a-fA-F0-9]{24}$/)
          .required()
      }
    },
  
    // PATCH /v1/users/:userId
    updateUser: {
      body: {
        email: Joi.string().email(),
        password: Joi.string().min(6).max(128),
        role: Joi.string().valid('user', 'admin')
      },
      params: {
        userId: Joi.string()
          .regex(/^[a-fA-F0-9]{24}$/)
          .required()
      }
    }
  }
  