import createAxios from '/@/utils/axios'

export const url = '/admin/routine.AdminInfo/'

export const actionUrl = new Map([
    ['index', url + 'index'],
    ['edit', url + 'edit'],
    ['log', '/admin/auth.AdminLog/index'],
    ['walletSummary', url + 'walletSummary'],
    ['walletRecords', url + 'walletRecords'],
    ['withdrawApply', url + 'withdrawApply'],
])

export function index() {
    return createAxios({
        url: actionUrl.get('index'),
        method: 'get',
    })
}

export function log(filter: anyObj = {}) {
    return createAxios<TableDefaultData>({
        url: actionUrl.get('log'),
        method: 'get',
        params: filter,
    })
}

export function postData(data: anyObj) {
    return createAxios(
        {
            url: actionUrl.get('edit'),
            method: 'post',
            data: data,
        },
        {
            showSuccessMessage: true,
        }
    )
}

export function walletSummary() {
    return createAxios({
        url: actionUrl.get('walletSummary'),
        method: 'get',
    })
}

export function walletRecords(filter: anyObj = {}) {
    return createAxios<TableDefaultData>({
        url: actionUrl.get('walletRecords'),
        method: 'get',
        params: filter,
    })
}

export function withdrawApply(data: anyObj) {
    return createAxios(
        {
            url: actionUrl.get('withdrawApply'),
            method: 'post',
            data,
        },
        {
            showSuccessMessage: true,
        }
    )
}
