package statistic_report

import (
	"github.com/rdlucklib/rdluck_tools/paging"
	"hongze/hz_crm_api/models/company"
	"hongze/hz_crm_api/models/data_manage"
)

// CompanyReportRecordResp 总统计信息
type CompanyReportRecordResp struct {
	List                       []GroupReportRecord      `description:"系统用户分组信息"`
	CompanyReportRecordNumList []CompanyReportRecordNum `description:"统计次数"`
}

// GroupReportRecord 分组统计信息
type GroupReportRecord struct {
	Item                       []AdminReportRecord      `description:"系统用户信息"`
	GroupId                    int                      `description:"系统用户分组id"`
	Name                       string                   `description:"分组名"`
	CompanyReportRecordNumList []CompanyReportRecordNum `description:"统计次数"`
}

// AdminReportRecord 系统用户统计信息
type AdminReportRecord struct {
	Name                       string                   `description:"系统用户名"`
	AdminId                    int                      `description:"系统用户id"`
	CompanyReportRecordNumList []CompanyReportRecordNum `description:"统计次数"`
}

// CompanyReportRecordNum 系统用户统计信息
type CompanyReportRecordNum struct {
	TryOutNum              int    `description:"试用客户数"`
	TryOutIds              string `description:"试用客户ids"`
	FormalNum              int    `description:"正式客户数"`
	FormalIds              string `description:"正式客户ids"`
	ActiveNum              int    `description:"活跃客户数"`
	ActiveIds              string `description:"活跃客户ids"`
	AllActiveNum           int    `description:"所有活跃客户状态数"`
	AllActiveIds           string `description:"所有活跃客户ids"`
	NoIncrementalActiveNum int    `description:"非新增试用客户的活跃客户状态数"`
	NoIncrementalActiveIds string `description:"非新增试用客户的活跃客户ids"`
	StartDate              string `description:"开始日期"`
	EndDate                string `description:"结束日期"`
	TryStagePushNum        int    `description:"试用（推进）状态的客户数量"`
	TryStageFollowNum      int    `description:"试用（跟踪）状态的客户数量"`
	TryStageReadyNum       int    `description:"试用（预备）状态的客户数量"`
	TryStageInitNum        int    `description:"试用（未分类）状态的客户数量"`
}

type CompanyReportRecordGroup struct {
	AdminId   int    `description:"系统用户id"`
	GroupId   int    `description:"系统用户分组id"`
	AdminName string `description:"系统用户名称"`
	Num       int    `description:"汇总次数"`
}

type CompanyListResp struct {
	Paging *paging.PagingItem
	List   []*CompanyListItem
}

type YbProductUserListResp struct {
	Paging *paging.PagingItem
	List   []*YbProductUserListItem
}
type YbProductUserListItem struct {
	CompanyListItem
	OldUserId   int
	OldRealName string
	YbLogNum    int
}

type YbCollectUserListResp struct {
	Paging *paging.PagingItem
	List   []*YbCollectUserListItem
}
type YbCollectUserListItem struct {
	CompanyListItem
	OldUserId   int
	OldRealName string
	CollectNum  int
}

type CollectListResp struct {
	Paging *paging.PagingItem
	List   []*CollectListItem
}

type CollectListItem struct {
	CollectionId   uint
	CollectionType uint8
	UserId         uint
	Title          string
	ModifyTime     string
}

type CompanyListItem struct {
	CompanyId           int                         `orm:"column(company_id);pk"`
	CompanyName         string                      `description:"客户名称"`
	CreditCode          string                      `description:"社会统一信用码"`
	CompanyCode         string                      `description:"客户编码"`
	StartDate           string                      `description:"合同开始日期"`
	EndDate             string                      `description:"合同结束日期"`
	LoseReason          string                      `description:"流失原因"`
	RenewalReason       string                      `description:"续约说明"`
	FreezeReason        string                      `description:"冻结理由"`
	LossTime            string                      `description:"流失时间"`
	Status              string                      `description:"客户状态：'试用','永续','冻结','流失','正式' "`
	CompanyType         string                      `description:"客户类型：ficc/权益"`
	ApproveStatus       string                      `description:"审批状态：'待审批','已审批','驳回' 审批状态为空时，表示没有审批申请"`
	SellerName          string                      `description:"销售：吉根龙/颖丹"`
	SellerId            int                         `description:"销售ID"`
	SellerIds           string                      `description:"销售ID集合，包含ficc和权益的销售id"`
	FiccPackageType     int                         `description:"ficc的套餐类型"`
	ExpireDay           string                      `description:"到期天数"`
	FreezeTime          string                      `description:"冻结时间"`
	GroupId             int                         `description:"分组id"`
	GroupIds            string                      `description:"分组id集合，包含ficc和权益的小组id" json:"-"`
	DepartmentId        int                         `description:"部门id"`
	IndustryName        string                      `description:"所属行业"`
	IsSuspend           int                         `description:"是否暂停:1:暂停,0:启用 "`
	CreatedTime         string                      `description:"创建时间"`
	Source              string                      `description:"客户来源"`
	Province            string                      `description:"省"`
	City                string                      `description:"市"`
	Address             string                      `description:"详细地址"`
	Reasons             string                      `description:"新增理由"`
	FreezeStartDate     string                      `description:"冻结开始日期"`
	FreezeEndDate       string                      `description:"冻结结束日期"`
	FreezeExpireDays    int                         `description:"冻结到期天数"`
	ProductId           int                         `json:"-"`
	FormalTime          string                      `description:"转正时间"`
	IsShared            bool                        `description:"是否共享客户"`
	RegionType          string                      `description:"区域：国内，海外"`
	FiccView            int                         `description:"Ficc报告阅读次数"`
	RaiView             int                         `description:"权益报告阅读次数"`
	FiccLastViewTime    string                      `description:"ficc最近一次阅读时间"`
	RaiLastViewTime     string                      `description:"权益最近一次阅读时间"`
	RoadShowTotal       int                         `description:"累计路演次数"`
	TodoStatus          bool                        `description:"是否存在进行中任务，true：存在待处理的任务"`
	CanConfirm          bool                        `description:"是否允许完成任务，true：允许完成任务"`
	HiddenConfirm       bool                        `description:"是否隐藏完成任务按钮，true：隐藏完成任务按钮"`
	HiddenCreate        bool                        `description:"是否隐藏新增/编辑按钮，true：隐藏新增/编辑按钮"`
	TodoButtonColor     string                      `description:"任务按钮颜色：red，green，gray"`
	AllViewTotal        int                         `description:"总阅读数"`
	Deadline            string                      `description:"未完成的todo任务的截止日期，截止目前还剩余的天数"`
	IsShow              bool                        `description:"是否有权限展示（是否属于本组或自己下面的客户）"`
	TryStageSlice       []company.TryStageSliceItem `description:"试用状态相关"`
	FiccTryOutDay       int                         `description:"Ficc总试用天数"`
	RaiTryOutDay        int                         `description:"权益总试用天数"`
	ShareSellerId       int                         `description:"分配的咨询组销售ID"`
	ShareSeller         string                      `description:"分配的咨询组销售名称"`
	ServiceYears        string                      `description:"客户服务年限"`
	LatestServiceRecord string                      `description:"最近沟通时间"`
}

// CompanyRenewRecordResp 总统计信息
type CompanyRenewRecordResp struct {
	List                      []GroupRenewRecord      `description:"系统用户分组信息"`
	CompanyRenewRecordNumList []CompanyRenewRecordNum `description:"统计次数"`
}

// GroupRenewRecord 分组统计信息
type GroupRenewRecord struct {
	Item                      []AdminRenewRecord      `description:"系统用户信息"`
	GroupId                   int                     `description:"系统用户分组id"`
	Name                      string                  `description:"分组名"`
	CompanyRenewRecordNumList []CompanyRenewRecordNum `description:"统计次数"`
}

// AdminReportRecord 系统用户统计信息
type AdminRenewRecord struct {
	Name                      string                  `description:"系统用户名"`
	AdminId                   int                     `description:"系统用户id"`
	CompanyRenewRecordNumList []CompanyRenewRecordNum `description:"统计次数"`
}

// CompanyRenewRecordNum 系统续约客户统计信息
type CompanyRenewRecordNum struct {
	NotRenewNum     int    `description:"未续约客户数"`
	NotRenewIds     string `description:"未续约客户ids"`
	RenewFollowNum  int    `description:"续约跟进客户数"`
	RenewFollowIds  string `description:"续约跟进客户ids"`
	ExpireNum       int    `description:"到期客户数"`
	ExpireIds       string `description:"到期客户ids"`
	RenewNum        int    `description:"续约客户数"`
	RenewIds        string `description:"续约客户ids"`
	StartDate       string `description:"开始日期"`
	EndDate         string `description:"结束日期"`
	UnusualRenewNum int    `description:"续约异常客户数"`
	UnusualRenewIds string `description:"续约异常客户ids"`
	UnusualRate     string `description:"异常率"`
}

type YbChartCollectListResp struct {
	Paging *paging.PagingItem
	List   []YbChartCollectListItem
}

type YbChartCollectListItem struct {
	Id         int
	ChartInfo  *data_manage.ChartInfoView
	CreateTime string
}

// CompanyUnusualRenewRecordResp
// @Description: 续约异常客户统计返回
type CompanyUnusualRenewRecordResp struct {
	List        []GroupUnusualRenewRecord      `description:"系统用户分组信息"`
	SummaryList []SummaryUnusualRenewRecordNum `description:"汇总信息"`
}

// GroupUnusualRenewRecord
// @Description: 续约异常的分组信息
type GroupUnusualRenewRecord struct {
	SellerId                  int                            `description:"销售ID"`
	SellerName                string                         `description:"销售名称"`
	CompanyRenewRecordNumList []CompanyUnusualRenewRecordNum `description:"统计次数"`
}

// CompanyUnusualRenewRecordNum
// @Description: 续约异常客户统计信息
type CompanyUnusualRenewRecordNum struct {
	StartDate       string `description:"开始日期"`
	EndDate         string `description:"结束日期"`
	UnusualRenewNum int    `description:"续约异常客户数"`
	UnusualRenewIds string `description:"续约异常客户ids"`
	UnusualRate     string `description:"异常率"`
}

// SummaryUnusualRenewRecordNum
// @Description: 续约异常客户汇总数据
type SummaryUnusualRenewRecordNum struct {
	UnusualRenewNum int    `description:"续约异常客户数"`
	UnusualRenewIds string `description:"续约异常客户ids"`
	UnusualRate     string `description:"异常率"`
}
