import client from './client'
export * from './channelSubject'
export * from './channelAccount'

export interface ChannelIdentityQuery {
  keyword?: string
}

export function createConversation(data: any) {
  return client.post('/api/v1/conversation', data)
}

export function listConversations() {
  return client.get('/api/v1/conversation/list')
}

export function updateConversation(id: number, data: any) {
  return client.put(`/api/v1/conversation/${id}`, data)
}

export function deleteConversation(id: number) {
  return client.delete(`/api/v1/conversation/${id}`)
}

export function bindConversationAccount(conversationId: number, data: any) {
  return client.post(`/api/v1/conversation/${conversationId}/bind-account`, data)
}

export function bindConversationTags(conversationId: number, data: any) {
  return client.post(`/api/v1/conversation/${conversationId}/bind-tags`, data)
}

export function listChannelIdentities(params?: ChannelIdentityQuery) {
  return client.get('/api/v1/channel-identity/list', { params })
}

export function listConversationParticipants(conversationId: number) {
  return client.get(`/api/v1/conversation/${conversationId}/participants`)
}

export function listConversationTags(conversationId: number) {
  return client.get(`/api/v1/conversation/${conversationId}/tags`)
}
