import type {DashboardPageType} from "~/utils/enums.ts";

interface IKeyString {
    [key: string]: any;
}

export interface BaseRetData extends IKeyString {
    success: boolean,
    message: string,
    data?: any
}

export interface PerformanceGetListResponse extends BaseRetData {
    data?: PerformanceGetListData
}

export interface PerformanceGetListData extends BaseRetData {
    idx: number,
    request_count: number,
    grpc: PerformanceResultsGetList,
    rest: PerformanceResultsGetList,
}

export interface PerformanceResultsGetList extends PerformanceResults {
    response_data?: BookInfo[]
}

export interface PerformanceResults extends IKeyString {
    client_networking_ping: number,
    client_request_cpu: number,
    client_request_time: number,
    server_deserialize_cpu: number,
    server_deserialize_time: number,
    server_serialize_cpu: number,
    server_serialize_time: number,
    server_protocol_total_time: number,
    networking_size: {
        request_size: number,
        response_size: number
    },
    response_data?: any
}

export interface BookInfo extends IKeyString {
    "abstract": string
    "author": string
    "barcode": string
    "binding": string
    "category_id": number,
    "cover_image": string
    "description": string
    "edition": string
    "editor": string
    "format": string
    "isbn": string
    "keywords": string
    "language": string
    "pages": number,
    "publication_date": string
    "publisher": string
    "subject": string
    "subtitle": string
    "title": string
    "translator": string
    "weight": number
}

export interface OutletContextType {
    refreshMyInfo: () => void;
    changePage: (pageType: DashboardPageType, navigateTo?: string) => void;
}
