/*
 * @Author: Kane
 * 
 * @Date: 2023-04-05 22:34:36
 * 
 * @LastEditors: Kane
 * 
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/QueryResponse.java
 * 
 * @Description:
 *
 * Copyright (c) ${2022} by Kane, All Rights Reserved.
 */
package com.cpic.xim.web.controllers;

import com.fasterxml.jackson.annotation.JsonProperty;

public class QueryResponse
{
    @JsonProperty( "success" )
    private boolean success;

    @JsonProperty( "message" )
    private String message;

    public QueryResponse( boolean success, String message )
    {
        this.success = success;
        this.message = message;
    }

    public QueryResponse()
    {
        this.success = false;
        this.message = "";
    }

    public boolean isSuccess()
    {
        return success;
    }

    public void setSuccess( boolean success )
    {
        this.success = success;
    }

    public String getMessage()
    {
        return message;
    }

    public void setMessage( String message )
    {
        this.message = message;
    }

    @Override
    public int hashCode()
    {
        final int prime  = 31;
        int       result = 1;
        result = prime * result + (success ? 1231 : 1237);
        result = prime * result + ((message == null) ? 0 : message.hashCode());
        return result;
    }

    @Override
    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( getClass() != obj.getClass() )
            return false;
        QueryResponse other = ( QueryResponse ) obj;
        if ( success != other.success )
            return false;
        if ( message == null )
        {
            if ( other.message != null )
                return false;
        }
        else if ( !message.equals( other.message ) )
            return false;
        return true;
    }

    @Override
    public String toString()
    {
        return "QueryResult [success=" + success + ", message=" + message + "]";
    }
}
