import {
  POST_SET_RTSP_ENABLE,
  POST_SET_SAMBA_DIRECTORY,
} from "./api";
import instance from "@/util/request";
import apiHandler from "@/util/apiHandler";

/**
 * 開關 RTSP
 * Swagger: POST /api/rtsp/set-rtsp-enable
 * body: { main_id: number, enable: boolean }
 */
export const setRtspEnable = async ({ main_id, enable }) => {
  const res = await instance.post(POST_SET_RTSP_ENABLE, { main_id, enable });
  return apiHandler(res.code, res.data, { msg: res.msg, code: res.code });
};

/**
 * 設定 SAMBA 儲存目錄
 * Swagger: POST /api/rtsp/set-samba-directory
 * body: { main_id: number, directory: string }
 */
export const setSambaDirectory = async ({ main_id, directory }) => {
  const res = await instance.post(POST_SET_SAMBA_DIRECTORY, {
    main_id,
    directory,
  });
  return apiHandler(res.code, res.data, { msg: res.msg, code: res.code });
};
