import { chatRequest } from '@/lib/client';

export async function getUserToken(data: { userId: string; userName: string }) {
  return await chatRequest('/chat-api/v1/im/user/createOrGet', {
    method: 'post',
    data: data,
  });
}

export async function createChannel(data: any) {
  return await chatRequest('/chat-api/v1/im/user/conversation/create', {
    method: 'post',
    data: data,
  });
}

export async function deleteChannel(chanelIds: string[]) {
  return await chatRequest('/chat-api/v1/im/user/conversation/delete', {
    method: 'post',
    data: { chanelIds },
  });
}

export async function fetchUserChatSetting(params: any) {
  return await chatRequest('/chat-api/user/setting/chat/select', {
    method: 'post',
    data: params,
  });
}

export async function updateUserChatSetting(params: any) {
  return await chatRequest('/chat-api/user/setting/chat/createOrUpdate', {
    method: 'post',
    data: params,
  });
}

export async function fetchModels() {
  const { data } = await chatRequest('/chat-api/user/setting/model/list', {
    method: 'post',
  });
  return data;
}
