package message

import (
	"github.com/tidbcloud/observability/o11ymetering/pkg/common/constants"
	"github.com/tidbcloud/observability/o11ymetering/pkg/common/models"
)

type ScopeReq struct {
}

type GenerateStatisticTaskReq struct {
	Period string `json:"period" form:"period" validate:"required"`
}

type GenerateStatisticTaskResp struct {
	TaskIDs []string `json:"taskIDs" form:"taskIDs"`
}

type ExecuteStatisticTaskReq struct {
	ID string `json:"id" form:"id"`
}

type ExecuteStatisticTaskResp struct {
	RecordsCount int32 `json:"recordsCount" form:"recordsCount"`
}

type GenerateStatisticReportReq struct {
	Timestamp int32 `json:"timestamp" form:"timestamp"`
}

type GenerateStatisticReportResp struct {
}

type ShareCostsStatisticReportReq struct {
	Timestamp     int32                   `json:"timestamp" form:"timestamp"`
	StartPeriod   string                  `json:"startPeriod" form:"startPeriod"`
	EndPeriod     string                  `json:"endPeriod" form:"endPeriod"`
	StatisticName constants.StatisticName `json:"statisticName" form:"statisticName"`
	Category      constants.Category      `json:"category" form:"category"`
	CloudService  constants.CloudService  `json:"cloudService" form:"cloudService"`
}

type ShareCostsStatisticReportResp struct {
	TenantStatisticReport []*models.MonthlyStatisticReport `json:"tenantShareCosts" form:"timestamp"`
}

type MonthlyProportionSumReq struct {
	Timestamp int32 `json:"timestamp" form:"timestamp"`
}

type MonthlyProportionSumResp struct {
	Timestamp int32  `json:"timestamp" form:"timestamp"`
	File      string `json:"file" form:"file"` // The file path where the monthly proportion sum is stored
}

type ReplayStatisticTasksReq struct {
	StartTimestamp int64                     `json:"startTimestamp" form:"startTimestamp" validate:"required"` // Unix timestamp for start of replay period
	EndTimestamp   int64                     `json:"endTimestamp" form:"endTimestamp" validate:"required"`     // Unix timestamp for end of replay period
	StatisticClass *constants.StatisticClass `json:"statisticClass,omitempty" form:"statisticClass"`           // Optional: filter by statistic class
	MeteringGroup  *constants.MeteringGroup  `json:"meteringGroup,omitempty" form:"meteringGroup"`             // Optional: filter by metering group
	Env            *constants.BizEnv         `json:"env,omitempty" form:"env"`                                 // Optional: filter by environment
}

type ReplayStatisticTasksResp struct {
	TasksGenerated int    `json:"tasksGenerated" form:"tasksGenerated"`
	Message        string `json:"message" form:"message"`
}
