import { Request, Response } from 'express';
import validator from 'joi'; // DOCS: https://joi.dev/api

// MARK: GET user codecheck
const schema_get = validator.object({
	id: validator.number().positive().precision(0).required(),
	code: validator
		.string()
		.min(4)
		.max(4)
		.trim()
		.regex(new RegExp(/^[0-9]+$/))
		.required()
});

// Describe all schemas
const schema_get_desc = schema_get.describe();
// const schema_post_desc = schema_post.describe();
// const schema_patch_desc = schema_patch.describe();
// const schema_del_desc = schema_del.describe();

// GET route
export default async function get(req: Request, res: Response) {
	res.status(200).json({
		GET: schema_get_desc
		// POST: schema_post_desc,
		// PATCH: schema_patch_desc,
		// DELETE: schema_del_desc
	});
}

export { schema_get }; //, schema_post, schema_patch, schema_del };
