import request from '/@/utils/request';

// 主播管理API接口

export interface AnchorListParams {
	pageNum: number;
	pageSize: number;
	name?: string;
	phone?: string;
	code?: string;
	status?: number;
}

export interface AnchorParams {
	id?: string;
	name: string;
	phone: string;
	code: string;
	status?: number;
	remark?: string;
}

export function getAnchorList(data: AnchorListParams) {
	return request({
		url: '/erp/anchor/controller/listAnchors',
		method: 'get',
		params: data,
	});
}

export function getAnchorOne(data: { id: string }) {
	return request({
		url: '/erp/anchor/controller/getAnchor',
		method: 'get',
		params: data,
	});
}

export function addAnchor(data: AnchorParams) {
	return request({
		url: '/erp/anchor/controller/createAnchor',
		method: 'post',
		data: data,
	});
}

export function updateAnchor(data: AnchorParams) {
	return request({
		url: '/erp/anchor/controller/updateAnchor',
		method: 'put',
		data: data,
	});
}

export function deleteAnchor(data: { id: string }) {
	return request({
		url: '/erp/anchor/controller/deleteAnchor',
		method: 'delete',
		params: data,
	});
}

export function updateAnchorStatus(data: { id: string; status: number }) {
	return request({
		url: '/erp/anchor/controller/updateAnchorStatus',
		method: 'post',
		data: data,
	});
}
