/* eslint-disable */
// @ts-ignore
import request from '@/http/vue-query';
import type { CustomRequestOptions } from '@/http/types';

type AnyRecord = Record<string, any>;
export type DiningProfileFields = Record<string, unknown>;

export type DiningProfileConfigItem = {
  groupKey: string;
  groupName: string;
  fieldKey: string;
  fieldName: string;
  optionsJson: string;
  sortNum: number;
  isRequired: number | null;
  multiSelect: number;
};

/** 查询当前可用画像配置 GET /app/diningProfile/config */
export async function appDiningProfileConfigGet({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<{ code: number; data: DiningProfileConfigItem[]; msg?: string }>(
    '/app/diningProfile/config',
    {
      method: 'GET',
      ...(options || {}),
    }
  );
}

/** 查询当前登录用户画像 GET /app/diningProfile */
export async function appDiningProfileGet({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<{ code: number; data: DiningProfileFields | null; msg?: string }>(
    '/app/diningProfile',
    {
      method: 'GET',
      ...(options || {}),
    }
  );
}

/** 保存画像配置 POST /app/diningProfile/save */
export async function appDiningProfileSavePost({
  body,
  options,
}: {
  body: { fields: DiningProfileFields };
  options?: CustomRequestOptions;
}) {
  return request<{ code: number; data: AnyRecord | null; msg?: string }>(
    '/app/diningProfile/save',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    }
  );
}

