import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TeamMemberVo, TeamMemberBo } from './types';

/** 按对象编号查询团队成员列表 */
export function listTeamMember(objectNo: string): AxiosPromise<TeamMemberVo[]> {
    return request({
        url: '/customer/teamMember/list/' + objectNo,
        method: 'get'
    });
}

/** 获取团队成员详细信息 */
export function getTeamMember(id: string | number): AxiosPromise<TeamMemberVo> {
    return request({
        url: '/customer/teamMember/' + id,
        method: 'get'
    });
}

/** 新增团队成员 */
export function addTeamMember(data: TeamMemberBo): AxiosPromise<void> {
    return request({
        url: '/customer/teamMember',
        method: 'post',
        data
    });
}

/** 修改团队成员 */
export function updateTeamMember(data: TeamMemberBo): AxiosPromise<void> {
    return request({
        url: '/customer/teamMember',
        method: 'put',
        data
    });
}

/** 删除团队成员 */
export function delTeamMember(ids: string | number | (string | number)[]): AxiosPromise<void> {
    return request({
        url: '/customer/teamMember/' + ids,
        method: 'delete'
    });
}
