package liveschema

import (
	"honoka-chan/internal/constant"
	userschema "honoka-chan/internal/schema/user"
)

type RewardReq struct {
	Module           string          `json:"module"`
	Action           string          `json:"action"`
	GoodCnt          int             `json:"good_cnt"`
	MissCnt          int             `json:"miss_cnt"`
	IsTraining       bool            `json:"is_training"`
	GreatCnt         int             `json:"great_cnt"`
	CommandNum       string          `json:"commandNum"`
	LoveCnt          int             `json:"love_cnt"`
	RemainHp         int             `json:"remain_hp"`
	MaxCombo         int             `json:"max_combo"`
	ScoreSmile       int             `json:"score_smile"`
	PerfectCnt       int             `json:"perfect_cnt"`
	BadCnt           int             `json:"bad_cnt"`
	Mgd              int             `json:"mgd"`
	EventPoint       int             `json:"event_point"`
	LiveDifficultyID int             `json:"live_difficulty_id"`
	TimeStamp        int             `json:"timeStamp"`
	PreciseScoreLog  PreciseScoreLog `json:"precise_score_log"`
	ScoreCute        int             `json:"score_cute"`
	EventID          any             `json:"event_id"`
	ScoreCool        int             `json:"score_cool"`
}

type Icon struct {
	SlideID  int `json:"slide_id"`
	JustID   int `json:"just_id"`
	NormalID int `json:"normal_id"`
}

type LiveSetting struct {
	StringSize                 int                             `json:"string_size"`
	PreciseScoreAutoUpdateFlag bool                            `json:"precise_score_auto_update_flag"`
	SeID                       int                             `json:"se_id"`
	CutinBrightness            int                             `json:"cutin_brightness"`
	RandomValue                int                             `json:"random_value"`
	PreciseScoreUpdateType     constant.PreciseScoreUpdateType `json:"precise_score_update_type"`
	EffectFlag                 bool                            `json:"effect_flag"`
	NotesSpeed                 float64                         `json:"notes_speed"`
	Icon                       Icon                            `json:"icon"`
	CutinType                  int                             `json:"cutin_type"`
	BackgroundID               any                             `json:"background_id"`
}

type PreciseList struct {
	Count      int     `json:"count"`
	Effect     int     `json:"effect"`
	Accuracy   int     `json:"accuracy"`
	Tap        float64 `json:"tap"`
	IsSame     bool    `json:"is_same"`
	Release    any     `json:"release"`
	Position   int     `json:"position"`
	NoteNumber int     `json:"note_number"`
	FirstTouch any     `json:"first_touch"`
	Tp         any     `json:"tp"`
	Tpf        any     `json:"tpf"`
}

type BackgroundScore struct {
	Smile int `json:"smile"`
	Cute  int `json:"cute"`
	Cool  int `json:"cool"`
}

type TriggerLog struct {
	ActivationRate int `json:"activation_rate"`
	Position       int `json:"position"`
}

type PreciseScoreLog struct {
	LiveSetting     LiveSetting     `json:"live_setting"`
	TapAdjust       int             `json:"tap_adjust"`
	PreciseList     []PreciseList   `json:"precise_list"`
	BackgroundScore BackgroundScore `json:"background_score"`
	IsLogOn         bool            `json:"is_log_on"`
	ScoreLog        []int           `json:"score_log"`
	IsSkillOn       bool            `json:"is_skill_on"`
	TriggerLog      []TriggerLog    `json:"trigger_log"`
	RandomSeed      int             `json:"random_seed"`
}

type RewardLiveInfo struct {
	LiveDifficultyID int  `json:"live_difficulty_id"`
	IsRandom         bool `json:"is_random"`
	AcFlag           int  `json:"ac_flag"`
	SwingFlag        int  `json:"swing_flag"`
}

type PlayerExpUnitMax struct {
	Before int `json:"before"`
	After  int `json:"after"`
}

type PlayerExpFriendMax struct {
	Before int `json:"before"`
	After  int `json:"after"`
}

type PlayerExpLpMax struct {
	Before int `json:"before"`
	After  int `json:"after"`
}

type BaseRewardInfo struct {
	PlayerExp             int                `json:"player_exp"`
	PlayerExpUnitMax      PlayerExpUnitMax   `json:"player_exp_unit_max"`
	PlayerExpFriendMax    PlayerExpFriendMax `json:"player_exp_friend_max"`
	PlayerExpLpMax        PlayerExpLpMax     `json:"player_exp_lp_max"`
	GameCoin              int                `json:"game_coin"`
	GameCoinRewardBoxFlag bool               `json:"game_coin_reward_box_flag"`
	SocialPoint           int                `json:"social_point"`
}

type LiveClear struct {
	AddType                    int   `json:"add_type"`
	Amount                     int   `json:"amount"`
	ItemCategoryID             int   `json:"item_category_id"`
	UnitID                     int   `json:"unit_id"`
	UnitOwningUserID           int64 `json:"unit_owning_user_id"`
	IsSupportMember            bool  `json:"is_support_member"`
	Exp                        int   `json:"exp"`
	NextExp                    int   `json:"next_exp"`
	MaxHp                      int   `json:"max_hp"`
	Level                      int   `json:"level"`
	MaxLevel                   int   `json:"max_level"`
	LevelLimitID               int   `json:"level_limit_id"`
	SkillLevel                 int   `json:"skill_level"`
	Rank                       int   `json:"rank"`
	Love                       int   `json:"love"`
	IsRankMax                  bool  `json:"is_rank_max"`
	IsLevelMax                 bool  `json:"is_level_max"`
	IsLoveMax                  bool  `json:"is_love_max"`
	IsSigned                   bool  `json:"is_signed"`
	NewUnitFlag                bool  `json:"new_unit_flag"`
	RewardBoxFlag              bool  `json:"reward_box_flag"`
	UnitSkillExp               int   `json:"unit_skill_exp"`
	DisplayRank                int   `json:"display_rank"`
	UnitRemovableSkillCapacity int   `json:"unit_removable_skill_capacity"`
	RemovableSkillIds          []any `json:"removable_skill_ids"`
}

type LiveRank struct {
	AddType                    int   `json:"add_type"`
	Amount                     int   `json:"amount"`
	ItemCategoryID             int   `json:"item_category_id"`
	UnitID                     int   `json:"unit_id"`
	UnitOwningUserID           int64 `json:"unit_owning_user_id"`
	IsSupportMember            bool  `json:"is_support_member"`
	Exp                        int   `json:"exp"`
	NextExp                    int   `json:"next_exp"`
	MaxHp                      int   `json:"max_hp"`
	Level                      int   `json:"level"`
	MaxLevel                   int   `json:"max_level"`
	LevelLimitID               int   `json:"level_limit_id"`
	SkillLevel                 int   `json:"skill_level"`
	Rank                       int   `json:"rank"`
	Love                       int   `json:"love"`
	IsRankMax                  bool  `json:"is_rank_max"`
	IsLevelMax                 bool  `json:"is_level_max"`
	IsLoveMax                  bool  `json:"is_love_max"`
	IsSigned                   bool  `json:"is_signed"`
	NewUnitFlag                bool  `json:"new_unit_flag"`
	RewardBoxFlag              bool  `json:"reward_box_flag"`
	UnitSkillExp               int   `json:"unit_skill_exp"`
	DisplayRank                int   `json:"display_rank"`
	UnitRemovableSkillCapacity int   `json:"unit_removable_skill_capacity"`
	RemovableSkillIds          []any `json:"removable_skill_ids"`
}

type RewardUnitList struct {
	LiveClear []LiveClear `json:"live_clear"`
	LiveRank  []LiveRank  `json:"live_rank"`
	LiveCombo []any       `json:"live_combo"`
}

type Rewards struct {
	Rarity         int    `json:"rarity"`
	ItemID         int    `json:"item_id"`
	AddType        int    `json:"add_type"`
	Amount         int    `json:"amount"`
	ItemCategoryID int    `json:"item_category_id"`
	RewardBoxFlag  bool   `json:"reward_box_flag"`
	InsertDate     string `json:"insert_date"`
}

type EffortPoint struct {
	LiveEffortPointBoxSpecID int       `json:"live_effort_point_box_spec_id"`
	Capacity                 int       `json:"capacity"`
	Before                   int       `json:"before"`
	After                    int       `json:"after"`
	Rewards                  []Rewards `json:"rewards"`
}

type PlayRewardUnitList struct {
	ID               int   `xorm:"id pk autoincr" json:"-"`
	UserDeckID       int   `xorm:"user_deck_id" json:"-"`
	UnitOwningUserID int   `xorm:"unit_owning_user_id" json:"unit_owning_user_id"`
	UnitID           int   `xorm:"unit_id" json:"unit_id"`
	Position         int   `xorm:"position" json:"position"`
	Level            int   `xorm:"level" json:"level"`
	LevelLimitID     int   `xorm:"level_limit_id" json:"level_limit_id"`
	DisplayRank      int   `xorm:"display_rank" json:"display_rank"`
	Love             int   `xorm:"love" json:"love"`
	UnitSkillLevel   int   `xorm:"unit_skill_level" json:"unit_skill_level"`
	IsRankMax        bool  `xorm:"is_rank_max" json:"is_rank_max"`
	IsLoveMax        bool  `xorm:"is_love_max" json:"is_love_max"`
	IsLevelMax       bool  `xorm:"is_level_max" json:"is_level_max"`
	IsSigned         bool  `xorm:"is_signed" json:"is_signed"`
	BeforeLove       int   `xorm:"before_love" json:"before_love"`
	MaxLove          int   `xorm:"max_love" json:"max_love"`
	InsertData       int64 `xorm:"insert_date" json:"-"`
}

type NextLevelInfo struct {
	Level   int `json:"level"`
	FromExp int `json:"from_exp"`
}

type GoalAccompInfo struct {
	AchievedIds []any `json:"achieved_ids"`
	Rewards     []any `json:"rewards"`
}

type RewardRankInfo struct {
	BeforeClassRankID int    `json:"before_class_rank_id"`
	AfterClassRankID  int    `json:"after_class_rank_id"`
	RankUpDate        string `json:"rank_up_date"`
}

type ClassSystem struct {
	RankInfo     RewardRankInfo `json:"rank_info"`
	CompleteFlag bool           `json:"complete_flag"`
	IsOpened     bool           `json:"is_opened"`
	IsVisible    bool           `json:"is_visible"`
}

type PlayRewardList struct {
	ItemID         int  `json:"item_id"`
	AddType        int  `json:"add_type"`
	Amount         int  `json:"amount"`
	ItemCategoryID int  `json:"item_category_id"`
	RewardBoxFlag  bool `json:"reward_box_flag"`
}

type AccomplishedAchievementList struct {
	AchievementID       int              `json:"achievement_id"`
	Count               int              `json:"count"`
	IsAccomplished      bool             `json:"is_accomplished"`
	InsertDate          string           `json:"insert_date"`
	EndDate             string           `json:"end_date"`
	RemainingTime       string           `json:"remaining_time"`
	IsNew               bool             `json:"is_new"`
	ForDisplay          bool             `json:"for_display"`
	IsLocked            bool             `json:"is_locked"`
	OpenConditionString string           `json:"open_condition_string"`
	AccomplishID        string           `json:"accomplish_id"`
	RewardList          []PlayRewardList `json:"reward_list"`
}

type Parameter struct {
	Smile int `json:"smile"`
	Pure  int `json:"pure"`
	Cool  int `json:"cool"`
}

type Museum struct {
	Parameter      Parameter `json:"parameter"`
	ContentsIDList []int     `json:"contents_id_list"`
}

type RewardUnitSupportList struct {
	UnitID int `json:"unit_id"`
	Amount int `json:"amount"`
}

type RewardData struct {
	LiveInfo                     []RewardLiveInfo              `json:"live_info"`
	Rank                         int                           `json:"rank"`
	ComboRank                    int                           `json:"combo_rank"`
	TotalLove                    int                           `json:"total_love"`
	IsHighScore                  bool                          `json:"is_high_score"`
	HiScore                      int                           `json:"hi_score"`
	BaseRewardInfo               BaseRewardInfo                `json:"base_reward_info"`
	RewardUnitList               RewardUnitList                `json:"reward_unit_list"`
	UnlockedSubscenarioIds       []any                         `json:"unlocked_subscenario_ids"`
	UnlockedMultiUnitScenarioIds []any                         `json:"unlocked_multi_unit_scenario_ids"`
	EffortPoint                  []EffortPoint                 `json:"effort_point"`
	IsEffortPointVisible         bool                          `json:"is_effort_point_visible"`
	LimitedEffortBox             []any                         `json:"limited_effort_box"`
	UnitList                     []PlayRewardUnitList          `json:"unit_list"`
	BeforeUserInfo               userschema.UserInfo           `json:"before_user_info"`
	AfterUserInfo                userschema.UserInfo           `json:"after_user_info"`
	NextLevelInfo                []NextLevelInfo               `json:"next_level_info"`
	GoalAccompInfo               GoalAccompInfo                `json:"goal_accomp_info"`
	SpecialRewardInfo            []any                         `json:"special_reward_info"`
	EventInfo                    []any                         `json:"event_info"`
	DailyRewardInfo              []any                         `json:"daily_reward_info"`
	CanSendFriendRequest         bool                          `json:"can_send_friend_request"`
	UsingBuffInfo                []any                         `json:"using_buff_info"`
	ClassSystem                  ClassSystem                   `json:"class_system"`
	AccomplishedAchievementList  []AccomplishedAchievementList `json:"accomplished_achievement_list"`
	UnaccomplishedAchievementCnt int                           `json:"unaccomplished_achievement_cnt"`
	AddedAchievementList         []any                         `json:"added_achievement_list"`
	MuseumInfo                   Museum                        `json:"museum_info"`
	UnitSupportList              []RewardUnitSupportList       `json:"unit_support_list"`
	ServerTimestamp              int64                         `json:"server_timestamp"`
	PresentCnt                   int                           `json:"present_cnt"`
}

type RewardResp struct {
	ResponseData RewardData `json:"response_data"`
	ReleaseInfo  []any      `json:"release_info"`
	StatusCode   int        `json:"status_code"`
}
