import { servicesVersion } from "typescript";
import service from ".";
import postservice from "./postindex";

interface loginData{
    username:string,
    password:string
}
export function login(data:any){
    return service({
        url:"/api/auth/login",
        method:"post",
        data
    })
}
export function logout(){
    return service({
        url:"/api/auth/logout",
        method:"get",
    })
}
export function authorize(){
    return service({
        url:"/api/user/me",
        method:"get"
    })
}

// 商品列表接口

export function getAllAlgorithm(){
    return service({
        url:"/api/algorithm/findall",
        method:"get"
    })
}

export function getAllField(){
    return service({
        url:"/api/algorithm/findfield",
        method:"get"
    })
}


export function getAllUse(){
    return service({
        url:"/api/algorithm/finduse",
        method:"get"
    })
}


export function updatePostAlgorithm(data:any){
    return postservice({
        url:"/api/algorithm/updateAlgorithm",
        method:"post",
        data
    })
}


export function addPostAlgorithm(data:any){
    return postservice({
        url:"/api/algorithm/addAlgorithm",
        method:"post",
        data
    })
}

export function deleteAlgorithm(data:any){
    return postservice({
        url:"/api/algorithm/deleteAlgorithm",
        method:"post",
        data
    })
}

export function updateField(data:any){
    return postservice({
        url:"api/field/updateField",
        method:"post",
        data
    })
}

export function deleteField(data:any){
    return postservice({
        url:"api/field/deleteField",
        method:"post",
        data
    })
}

export function addField(data:any){
    return postservice({
        url:"/api/field/addField",
        method:"post",
        data
    })
}
export function addUse(data:any){
    return postservice({
        url:"/api/use/addUse",
        method:"post",
        data
    })
}
export function deleteUse(data:any){
    return postservice({
        url:"/api/use/deleteUse",
        method:"post",
        data
    })
}
export function updateUse(data:any){
    return postservice({
        url:"/api/use/updateUse",
        method:"post",
        data
    })
}
