/**
 * Http请求参数
 */
export interface HttpRequest<T extends { req?: unknown, rsp?: unknown } = object> {
    data?: T['req'];
    success?: (res: HttpResponse<T['rsp']>) => void;
    fail?: (err: string) => void;
    complete?: () => void;
}

/**
 * Http响应结果
 */
export interface HttpResponse<T> {
    code: ResultCode;
    msg: string;
    total: number;
    data: T;
    page: number;
    pagesize: number;
}

/**
 * Http响应结果状态码
 */
export enum ResultCode {
    Success = 200, //成功
    Error = 101, //发生错误
    Fail = 102, //失败
    Warning = 103, //非法请求
    Unauthorized = 201, //授权失败
    ParameterError = 202, //参数错误
    InvalidToken = 203, //令牌无效
    InvalidSign = 204, //签名无效
}