import { usePost, stringify, useGet } from "@/.cool";
import type { SubjectCatalogResult } from './catalog'

export interface SubjectInfoResult {
    id?: string
    mainTitle?: string
    assistantTitle?: string
    content?: string
    subjectType?: string
    price?: string
    salePrice?: string
    dealNum?: string
    remark?: string
    updateUserId?: string
    updateUserName?: string
    createdUserId?: string
    createdUserName?: string
    createdTime?: string
    updateTime?: string
    interactionFlag?: boolean
    catalogList?: SubjectCatalogResult[]
    iconPath?: string
}

// export function getSubjectInfoPage(parameter: any) {
//     return useGet<GetPage<any>>(`/subject/info/page`, parameter)
// }
// export function addSubjectInfo(parameter: SubjectInfoResult) {
//     return usePost<any>(`/subject/info`, parameter)
// }
// export function updateSubjectInfo(parameter: SubjectInfoResult) {
//     return usePut<any>(`/subject/info/${parameter.id}`, parameter)
// }
export function fetchSubjectConfigInfo(parameter: any) {
    return useGet(`/subject/info/config/info/${parameter.id}`) as Promise<SubjectInfoResult>
}
export function fetchSubjectAppInfo(parameter: any) {
    return useGet(`/subject/info/app/info/${parameter.id}`) as Promise<any>
}
export function fetchSubjectInfo(parameter: any) {
    return useGet(`/subject/info/${parameter.id}`) as Promise<SubjectInfoResult>
}
// export function deleteSubjectInfos(parameter: string[]) {
//     return useDelete<any>(`/subject/info`, parameter)
// }

// export function exportSubjectInfo(parameter: any) {
//     return useGet<any>(`/subject/info/export`, parameter, {
//         responseType: 'blob',
//         headers: {
//             'Content-Type': 'application/json;charset=UTF-8',
//         },
//     })
// }
export function querySubjectInfo(parameter: any) {
    return useGet(`/subject/info`, parameter) as Promise<SubjectInfoResult[]>
}
export function querySubjectInfoNoLogin(parameter: any) {
    return useGet(`/subject/info/no/login`, parameter) as Promise<SubjectInfoResult[]>
}
export function querySubjectUnit(parameter: any) {
    return useGet(`/subject/unit`, parameter) as Promise<any[]>
}
