import useAxios from '@core/utils/useAxios' import type { AddId, Customer } from '@/model/customer' import type { TableInput } from '@core/type/baseTable' import type { Accounting } from "@/model/accounting" import type { Balance, SetActiveTime } from "@/model/product"; export const createProduct = async (obj: Customer) => await useAxios.post(`/admin/product`, obj) export const deleteCustomer = async (id: number) => await useAxios.delete(`/admin/product/${id}`) export const updateProduct = async (id: number, obj: Customer) => await useAxios.put(`/admin/product/${id}`, obj) export const getCustomerTable = async (params: TableInput) => await useAxios.post>('/admin/product/table', params) export const getCustomersList = async () => await useAxios.get(`/admin/product/list`) export const changeProductActivation = async (id: number) => await useAxios.get(`/admin/product/active/${id}`) export const changeCustomerOrderActivation = async (id: number) => await useAxios.get(`/admin/product/trade/${id}`) export const changeCustomerArchive = async (id: number) => await useAxios.get(`/admin/product/archive/${id}`) export const confirmUser = async (id: number) => await useAxios.get(`/admin/product/is_valid/${id}`) export const getCustomerArchiveTable = async (params: TableInput) => await useAxios.post>('/admin/product/archive/table', params) export const getSingleTable = async (params: TableInput) => await useAxios.post>('/admin/product/single/table', params) export const getSingleArchiveTable = async (params: TableInput) => await useAxios.post>('/admin/product/single/archive/table', params) export const getCustomerById = async (id: number) => { return await useAxios.get(`/admin/product/${id}`) } export const changeBuyActiveProduct = async (id?: number) => { return await useAxios.get(`/admin/product/open_buy/${id}`) } export const changeSellActiveProduct = async (id?: number) => { return await useAxios.get(`/admin/product/open_sell/${id}`) } export const changeActiveProduct = async (id: number) => { return await useAxios.get(`/admin/product/active/${id}`) } export const changeVisibilityProduct = async (id: number) => { return await useAxios.get(`/admin/product/hide/${id}`) } export const setActiveTime = async (open: string, close: string) =>{ await useAxios.put(`/admin/products`, {auto_open_at: open, auto_close_at: close}) } export const getBalance = async (startDate: string, endDate: string) => { return await useAxios.post('/admin/getBalance', {startDate, endDate}) }