import { request } from "@utils"; const API_PATH = "/bre/selection_rule"; const SelectionRuleAPI = { getSelectionRuleList(query: SelectionRulePageQuery) { return request>>({ url: `${API_PATH}/list`, method: "get", params: query, }); }, getSelectionRuleDetail(query: number) { return request>({ url: `${API_PATH}/detail/${query}`, method: "get", }); }, getSelectionRuleOptions() { return request>({ url: `${API_PATH}/options`, method: "get", }); }, createSelectionRule(body: SelectionRuleForm) { return request({ url: `${API_PATH}/create`, method: "post", data: body, }); }, updateSelectionRule(id: number, body: SelectionRuleForm) { return request({ url: `${API_PATH}/update/${id}`, method: "put", data: body, }); }, deleteSelectionRule(body: number[]) { return request({ url: `${API_PATH}/delete`, method: "delete", data: body, }); }, exportSelectionRule(body: SelectionRulePageQuery) { return request({ url: `${API_PATH}/export`, method: "post", data: body, responseType: "blob", }); }, downloadTemplateSelectionRule() { return request({ url: `${API_PATH}/download/template`, method: "post", responseType: "blob", }); }, importSelectionRule(body: FormData) { return request({ url: `${API_PATH}/import`, method: "post", data: body, headers: { "Content-Type": "multipart/form-data", }, }); }, }; export default SelectionRuleAPI; export interface SelectionRulePageQuery extends PageQuery, UserByQueryParams { rule_name?: string; target_id?: number; stage?: string; logic?: string; action?: string; enabled?: string; } export interface SelectionRuleOption { value: number; label: string; } export interface SelectionRuleTable extends BaseType { rule_name?: string; target_id?: number; target_name?: string; stage?: string; conditions_json?: string; logic?: string; action?: string; priority?: number; enabled?: string; remark?: string; } export interface SelectionRuleForm extends BaseFormType { rule_name?: string; target_id?: number; stage?: string; conditions_json?: string; logic?: string; action?: string; priority?: number; enabled?: string; remark?: string; }