export type Query = Partial<{
    appId: string,
}>;

export type Record = {
    id: string,
    dialog_name: string,
    length: number,
    create_time: string
};

// 定义状态
export type State = {
    query?: Query,
    listLoading: boolean,
    list: Record[],
    page: {
        pageNum: number,
        pageSize: number,
        total: number,
    },
};

// 只读状态
export type ReadonlyState = Readonly<State>;

// 修改状态
export type StateAction = {
    setQuery: (query: State['query']) => void,
    setListLoading: (loading: State['listLoading']) => void,
    setList: (list: State['list']) => void,
    setPage: (page: State['page']) => void,
};

// 仓库类型
export type DataExportStore = {
    state: ReadonlyState,
    onClickSearch: (query: Query) => Promise<any>,
    onClickReset: (query: Query) => Promise<any>,
    onChangePagination: (pageNum: number, pageSize: number) => Promise<any>,
    onClickDownload: (id: string, name: string) => Promise<any>,
    init: () => Promise<any>,
    reset: () => void,
};