import {
  CoinNetworkQueryParam,
  CoinNetworkPageResult,
  CoinNetworkItem,
  CoinNetworkFormData
} from '@/types/api/system/coinNetwork';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';

export function queryCoinNetwork(data: CoinNetworkQueryParam): AxiosPromise<CoinNetworkPageResult> {
  return request({
    url: 'admin/system/coin-network/page-query',
    method: 'post',
    params: data
  });
}

export function addCoinNetwork(data: CoinNetworkFormData): any {
  return request({
    url: 'admin/system/coin-network/create',
    method: 'post',
    params: data
  });
}

export function updateCoinNetwork(data: CoinNetworkFormData): any {
  return request({
    url: 'admin/system/coin-network/update',
    method: 'post',
    params: data
  });
}

export function deleteCoinNetwork(id: number): any {
  return request({
    url: 'admin/system/coin-network/delete',
    method: 'post',
    params: { id }
  });
}

export function updateCoinNetworkStatus(id: number, status: number): any {
  return request({
    url: 'admin/system/coin-network/update-status',
    method: 'post',
    params: { id, status }
  });
}

export function getAllCoinNetworks(): AxiosPromise<CoinNetworkItem[]> {
  return request({
    url: 'admin/system/coin-network/all',
    method: 'post'
  });
}
