package com.mzh.library.service;

import com.mzh.library.entity.AuthenticatedUser;

public class AuthenticationResult {
    private final boolean authenticated;
    private final AuthenticatedUser user;
    private final String message;

    private AuthenticationResult(boolean authenticated, AuthenticatedUser user, String message) {
        this.authenticated = authenticated;
        this.user = user;
        this.message = message;
    }

    public static AuthenticationResult success(AuthenticatedUser user) {
        return new AuthenticationResult(true, user, null);
    }

    public static AuthenticationResult failure(String message) {
        return new AuthenticationResult(false, null, message);
    }

    public boolean isAuthenticated() {
        return authenticated;
    }

    public AuthenticatedUser getUser() {
        return user;
    }

    public String getMessage() {
        return message;
    }
}
