import { request } from '../request'

/** Get dictionary list */
export function getDictionaryList(roomID?: number) {
  return request<Api.Common.CommonResponse>({
    url: '/Base/ActivityMain/GetDictionaryList',
    method: 'get',
    params: {
      RoomId: roomID,
    },
  })
}

/** 新增字段项目 */
export function addOrUpdateDictionary(data: Api.Dictionary.AddOrUpdateParams) {
  return request({
    url: '/Base/ActivityMain/AddOrUpdateDictionary',
    method: 'post',
    data,
  })
}

/** Delete dictionary */
export function deleteDictionary(DicID: number) {
  return request({
    url: `/Base/ActivityMain/DeleteDictionary/?DicID=${DicID}`,
    method: 'post',
    data: { DicID },
  })
}

/** 根据字典ID查询字典类型 */
export function getDictionaryListUITypeByDicID(dicID: number) {
  return request<Api.Common.CommonResponse>({
    url: '/Base/ActivityMain/GetDictionaryListUITypeByDicID',
    method: 'get',
    params: {
      DicID: dicID,
    },
  })
}

/** 根据字典ID新建下面的字典类型 */
export function addOrUpdateDictionaryUIType(data: Api.Dictionary.AddOrUpdateDictionaryUITypeParams) {
  return request({
    url: '/Base/ActivityMain/AddOrUpdateDictionaryUIType',
    method: 'post',
    data,
  })
}

/** 删除字典项 */
export function deleteDictionaryItem(DicUIID: number) {
  return request({
    url: `/Base/ActivityMain/DeleteDictionaryUIType/?DicUIID=${DicUIID}`,
    method: 'post',
    data: { DicUIID },
  })
}

/** 根据字典value查询字典项 */
export function getDictionaryItemListByDicID(DicValue: string) {
  return request<Api.Common.CommonResponse>({
    url: `/Base/ActivityMain/GetDictionaryListUITypeByDicValue/?DicValue=${DicValue}`,
    method: 'get',
    params: {
      DicValue,
    },
  })
}
