import { http } from '@/utils/http/axios';

//查询场景标签

export interface SceneLabelType {
  code?: string;
  createdAt?: string;
  id?: number;
  isDeleted?: number;
  name?: string;
  remark?: string;
  status?: number;
  updatedAt?: string;
}

export const querySceneLabel = (): Promise<SceneLabelType[]> => {
  return http.request({
    url: '/template/getSceneLabelList',
    method: 'get',
  });
};

//查询场景模板

export interface TemplateType {
  code?: string;
  createdAt?: string;
  id?: number;
  isDeleted?: number;
  name?: string;
  remark?: string;
  status?: number;
  updatedAt?: string;
}

export const querytemplate = (): Promise<TemplateType[]> => {
  return http.request({
    url: '/template/getSceneModuleList',
    method: 'get',
  });
};

//查询车间模板

export interface WorkshopModuleType {
  code?: string;
  createdAt?: string;
  id?: number;
  isDeleted?: number;
  name?: string;
  remark?: string;
  status?: number;
  updatedAt?: string;
}

export const queryWorkshopModule = (): Promise<WorkshopModuleType[]> => {
  return http.request({
    url: '/template/getWorkshopModuleList',
    method: 'get',
  });
};

//根据公司ID查询场景标签
export interface SceneLabelByCompanyType {
  code?: string;
  createdAt?: string;
  id?: number;
  isDeleted?: number;
  name?: string;
  remark?: string;
  status?: number;
  updatedAt?: string;
}

export const querySceneLabelByCompany = (): Promise<SceneLabelByCompanyType[]> => {
  return http.request({
    url: '/template/findSceneLabelByCompany',
    method: 'get',
  });
};

//保存公司-场景标签-场景模板关系

export interface SceneTempleteType {
  companyId?: number;
  createdAt?: string;
  id?: number;
  isDeleted?: number;
  remark?: string;
  sceneLabelId?: number;
  sceneModuleId?: number;
  updatedAt?: string;
}

export const addCompanyModuleLabel = (data: SceneTempleteType[]) => {
  return http.request({
    url: '/template/saveCompanyModuleLabelRel',
    method: 'post',
    data,
  });
};

//编辑公司-场景标签-场景模板关系
export const editCompanyModuleLabel = (data: SceneTempleteType[]) => {
  return http.request({
    url: '/template/updateCompanyModuleLabelRel',
    method: 'post',
    data,
  });
};

//保存车间-车间模板关系
export interface WorkShopTempleteType {
  id?: number;
  workshopId?: number;
  workshopModuleId?: number;
  remark?: string;
  createdAt?: string;
  isDeleted?: number;
  updatedAt?: string;
}

export const addWorkshopModuleLabel = (data: WorkShopTempleteType) => {
  return http.request({
    url: '/template/saveWorkshopModuleRel',
    method: 'post',
    data,
  });
};

export const editWorkshopModuleLabel = (data: WorkShopTempleteType) => {
  return http.request({
    url: '/template/updateWorkshopModuleRel',
    method: 'post',
    data,
  });
};
