import client from './client'

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

export function listPersons() {
  return client.get('/api/v1/person/list')
}

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

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

export function listPersonIdentities(personId: number) {
  return client.get(`/api/v1/person/${personId}/identities`)
}

export function createPersonIdentity(personId: number, data: any) {
  return client.post(`/api/v1/person/${personId}/identities`, data)
}

export function deletePersonIdentity(personId: number, identityId: number) {
  return client.delete(`/api/v1/person/${personId}/identities/${identityId}`)
}

export function bindPersonTags(personId: number, data: any) {
  return client.post(`/api/v1/person/${personId}/bind-tags`, data)
}

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

export function listTags() {
  return client.get('/api/v1/tag/list')
}

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

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