package api

import (
	"net/http"

	"gitlink.org.cn/cloudream/common/sdks"
	"gitlink.org.cn/cloudream/jcs-pub/client/internal/mount"
)

type MountService struct {
	*Client
}

func (c *Client) Mount() *MountService {
	return &MountService{
		Client: c,
	}
}

const MountDumpStatusPath = "/v1/mount/dumpStatus"

type MountDumpStatus struct{}

func (r *MountDumpStatus) MakeParam() *sdks.RequestParam {
	return sdks.MakeQueryParam(http.MethodGet, MountDumpStatusPath, r)
}

type MountDumpStatusPathResp struct {
	mount.MountStatus
}

func (r *MountDumpStatusPathResp) ParseResponse(resp *http.Response) error {
	return sdks.ParseCodeDataJSONResponse(resp, r)
}

func (c *MountService) DumpStatus(req MountDumpStatus) (*MountDumpStatusPathResp, error) {
	return JSONAPI(c.cfg, http.DefaultClient, &req, &MountDumpStatusPathResp{})
}
