<commit_before>package net.hawkengine.http;

import net.hawkengine.model.ServiceResult;
import net.hawkengine.model.User;
import net.hawkengine.services.UserService;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;


//TODO: implement scheme validation

@Consumes("application/json")
@Produces("application/json")
@Path("/account")
public class AccountController {

    private UserService usrService;

    public AccountController() {
        this.usrService = new UserService();
    }

    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/users")
    public Response getUsers() {
        ServiceResult result = this.usrService.getAll();
        return Response.status(Status.OK)
                .entity(result.getObject())
                .build();
    }

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/users")
    public Response addUser(User user) {

        ServiceResult result = this.usrService.add(user);

        if (result.hasError()){
            return Response.status(Status.BAD_REQUEST)
                    .entity(result.getMessage())
                    .type(MediaType.TEXT_HTML)
                    .build();<commit_msg>refactored boolean property with enum in Account Controller #213<commit_after>package net.hawkengine.http;

import net.hawkengine.model.ServiceResult;
import net.hawkengine.model.User;
import net.hawkengine.model.enums.NotificationType;
import net.hawkengine.services.UserService;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;


//TODO: implement scheme validation

@Consumes("application/json")
@Produces("application/json")
@Path("/account")
public class AccountController {

    private UserService usrService;

    public AccountController() {
        this.usrService = new UserService();
    }

    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/users")
    public Response getUsers() {
        ServiceResult result = this.usrService.getAll();
        return Response.status(Status.OK)
                .entity(result.getObject())
                .build();
    }

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/users")
    public Response addUser(User user) {

        ServiceResult result = this.usrService.add(user);

        if (result.getNotificationType() == NotificationType.ERROR){
            return Response.status(Status.BAD_REQUEST)
                    .entity(result.getMessage())
                    .type(MediaType.TEXT_HTML)
                    .build();
{'fraction_non_alphanumeric': 0.11731658955717118, 'fraction_numerical': 0.0009914077990746861, 'mean_word_length': 3.0905405405405406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '980390', 'n_tokens_mistral': 913, 'n_tokens_neox': 887, 'n_words': 158}