import { reactive, ref } from "vue";

export function createSourceStore() {
  const sources = ref<any>({ categories: [] });
  const endpoints = ref<any[]>([]);
  const draft = reactive({
    sourceId: "",
    categoryId: "custom",
    categoryName: "自定义接口",
    name: "",
    description: "",
    method: "GET",
    apiUrl: "",
    urlTemplate: "",
    thumbnailUrl: "",
    proxyMode: "client_direct",
    timeoutMs: 8000,
    retryCount: 1,
    cacheSeconds: 300,
    checkIntervalSec: 300,
    enabled: true,
    clientVisible: true,
    supportedFormats: "[\"json\"]",
  });

  return { sources, endpoints, draft };
}
