import * as Joi from 'joi' ; import { email , password , username } from '@schemas' ; const register = { body : Joi . object ( { username : username ( ) , email : email ( ) . required ( ) , password : password ( 'user' ) . required ( ) } ) } ; const login = { body : Joi . object ( { email : Joi . when ( 'context.apikey' , { is : null , then : email ( ) . required ( ) , otherwise : Joi . optional ( ) } ) , password : Joi . when ( 'context.apikey' , { is : null , then : password ( 'user' ) . required ( ) , otherwise : Joi . optional ( ) } ) , apikey : Joi . when ( 'context.password' , { is : null , then : Joi . string ( ) . length ( 64 ) . required ( ) , otherwise : Joi . optional ( ) } ) , refreshToken : Joi . string ( ) } ) } ; const refresh = { body : Joi . object ( { token : Joi . object ( ) . keys ( { refreshToken : Joi . string ( ) . required ( ) , } ) . required ( ) } ) } ; const oauthCb = { query : Joi . object ( { code : Joi . string ( ) . required ( ) , } ) } ; const confirm = { body : Joi . object ( { token : Joi . string ( ) . min ( 64 ) . required ( ) } ) } ; const requestPassword = { query : Joi . object ( { email : Joi . string ( ) . email ( ) . required ( ) } ) } ; export { register , login , refresh , oauthCb , confirm , requestPassword } ;