package com.miraclegarden.smsmessage.model;

/**
 * **********************
 *
 * @Author MiracleGarden
 * 创建时间： 2026/4/5
 * API错误响应
 * **********************
 */
public class ApiError {
    private int statusCode;
    private String error;
    private String message;

    public ApiError(int statusCode, String error, String message) {
        this.statusCode = statusCode;
        this.error = error;
        this.message = message;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getMessage() {
        return message;
    }

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

    /**
     * 判断是否因token失效导致的错误
     */
    public boolean isTokenExpired() {
        return statusCode == 401 && message != null && 
               (message.contains("登录已失效") || message.contains("token") || message.contains("Token"));
    }
}
