package http

import (
	"net/http"

	"git.gocasts.ir/ebhomengo/niki/salesreportapp/param"
	"github.com/labstack/echo/v4"
)

func (s *Server) getReportFilters(c echo.Context) error {

	var data param.GetReportFiltersRequest
	err := c.Bind(&data)
	if err != nil {
		return err
	}

	reports, err := s.SalesReportSvc.GetReportFilters(data.ReportId)
	if err != nil {
		return err
	}

	return c.JSON(http.StatusOK, echo.Map{
		"statusCode":        200,
		"Message":           "success",
		"filterable_fields": reports,
	})
}
