const AuthService = require('../services/auth.service');

class AuthController {
    async login(req, res) {
        if (req.sheepId) {
            const result = await AuthService.findUserByID(req.sheepId, req.mode);
            if (result) {
                return res.status(200).send(result);
            } else {
                return res.status(404).send({
                    message: 'Sheep not found.'
                });
            }
        } else {
            return res
                .status(403)
                .send({ message: 'The sheep does not have enough rights.' });
        }
    }
}

module.exports = new AuthController();