syntax = "v1"

info(
	title: // TODO: add title
	desc: // TODO: add description
	author: "double.huang"
	email: "2637309949@qq.com"
)

type PageResult {
	Page          int                      `json:"page"`
	Rows          int                      `json:"rows"`
	TotalSize     int64                    `json:"totalSize"`
	TotalPageSize int64                    `json:"totalPageSize"`
	Content       []map[string]interface{} `json:"content"`
}

type WXLoginResponse {
	OpenID     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionID    string `json:"unionid"`
	ErrCode    int    `json:"errcode"`
	ErrMsg     string `json:"errmsg"`
}

type Watermark {
	AppID     string `json:"appid"`
	TimeStamp int64  `json:"timestamp"`
}

type WXUserInfo {
	OpenID     string    `json:"openId,omitempty"`
	SessionKey string    `json:"SessionKey"`
	NickName   string    `json:"nickName"`
	AvatarUrl  string    `json:"avatarUrl"`
	Gender     int64     `json:"gender"`
	Country    string    `json:"country"`
	Province   string    `json:"province"`
	City       string    `json:"city"`
	UnionID    string    `json:"unionId,omitempty"`
	Language   string    `json:"language"`
	Watermark  Watermark `json:"watermark,omitempty"`
}

type ResUserInfo {
	UserInfo      WXUserInfo `json:"userInfo"`
	RawData       string     `json:"rawData"`
	Signature     string     `json:"signature"`
	EncryptedData string     `json:"encryptedData"`
	IV            string     `json:"iv"`
}

type loginByWeixinRequest {
	Code string `json:"code"`
	// UserInfo ResUserInfo `json:"userInfo"`
}

type AuthUserInfo {
	ID          int64  `json:"id"`
	Mobile      string `json:"mobile"`
	UserName    string `json:"username"`
	NickName    string `json:"nickname"`
	Gender      int64  `json:"gender"`
	Avatar      string `json:"avatar"`
	Birthday    int64  `json:"birthday"`
	ErpRoleType int64  `json:"erp_role_type"`
	ErpRole     string `json:"erp_role"`
	MkId        string `json:"mk_id"`
}

type loginByWeixinResponse {
	Token    string       `json:"token"`
	UserInfo AuthUserInfo `json:"userInfo"`
}

type jzQrcodeResponse {
	Id     int64  `json:"id"`
	FileId string `json:"fileId"`
}

type bindMobileRequest {
	Iv            string `json:"iv"`
	EncryptedData string `json:"encryptedData"`
}

type bindMobileResponse {
	Id int64 `json:"id"`
}

type partTimeUserAddRequest {
	Name        string `json:"name"`
	IponeNumber string `json:"ipone_number"`
	Sex         int64  `json:"sex"`
	MkId        string `json:"mk_id"`
	CityId      int64  `json:"city_id"` // 城市
}

type infoResponse {
	ID          int64  `json:"id"`
	Mobile      string `json:"mobile"`
	UserName    string `json:"username"`
	CityName    string `json:"cityname"`
	NickName    string `json:"nickname"`
	Gender      int64  `json:"gender"`
	Avatar      string `json:"avatar"`
	Birthday    int64  `json:"birthday"`
	ErpRoleType int64  `json:"erpRoleType"`
}

type punchClockRequest {
	Lat     string `json:"lat"`
	Address string `json:"address"`
	Type    int64  `json:"type"`
}

type enrollRequest {
	Scene        string `json:"scene"`
	Name         string `json:"name"`
	ContactName  string `json:"contactName"`
	ContactPhone string `json:"contactPhone"`
	SchId        int64  `json:"schId"`
	Location     string `json:"location"`
}

type enrollAddReq {
	StuName       string `json:"stu_name"`
	AgeGroup      int    `json:"age_group"`
	StuLinkPerson string `json:"stu_link_person"`
	StuPhone      string `json:"stu_phone"`
	SchId         int    `json:"sch_id"`
	Address       string `json:"address"`
	Sign          string `json:"sign"`
}

type Response {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type GetErpOptionsetReq {
	Code string `json:"code"`
}

// 认证模块
@server(
	group: auth
)
service i2bill-api {
	@handler Hello
	get /api/hello
	
	@handler LoginByWeixin
	post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
}

// 用户模块
@server(
	jwt: JwtAuth
	group: user
)
service i2bill-api {
	@handler JzQrCode
	get /api/user/share/jzQrcode returns(jzQrcodeResponse)
	
	@handler BindMobile
	post /api/user/bindMobile(bindMobileRequest) returns(Response)
	
	@handler GetUser
	get /api/user/info returns(infoResponse)
	
	@handler UpdateUser
	post /api/user/update returns(Response)
	
	@handler PunchClock
	post /api/user/punchClock(punchClockRequest) returns(Response)
	
	@handler PunchClockPage
	get /api/user/punchClock/page returns(Response)
	
	@handler PunchClockGet
	get /api/user/punchClock/get_to_day returns(Response)
	
}

// 兼职模块
@server(
	jwt: JwtAuth
	group: mkt_part_time_user
)
service i2bill-api {
	@handler  MktPartTimeUserAdd
	post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(Response)
	
	@handler  MktPartTimeUserUpdate
	post /api/v1/part_time_user/update (partTimeUserAddRequest) returns(Response)
	
	@handler  MktPartTimeUserGet
	get /api/v1/part_time_user/get  returns(Response)
}

// 收单模块
@server(
	jwt: JwtAuth
	group: acquirer
)
service i2bill-api {
	@handler Enroll
	post /api/acquirer/enroll(enrollRequest) returns(Response)
	
}

@server(
	jwt: JwtAuth
	group: acquirer_student
)

service i2bill-api{
	@handler AcquirerStudentPage
	get /api/v1/acquirer_student/page returns(Response)
	
	@handler AcquirerStudentTotal
	get  /api/v1/acquirer_student/total returns(Response)
}

@server(
	group: acquirer_student
)
service i2bill-api {
	@handler AcquirerStudentAdd
	post  /api/v1/acquirer_student/add(enrollAddReq) returns(Response)
}

//收单二维码
@server(
	jwt: JwtAuth
	group: acquirer_mkt_qr
)

service i2bill-api {
	@handler AcquirerMktQrUpdate
	post  /api/v1/acquirer_mkt_qr/update returns(Response)
	
	@handler AcquirerMktQrGet
	get  /api/v1/acquirer_mkt_qr/get returns(Response)
}

//系统
@server(
	jwt: JwtAuth
	group: system
)
service i2bill-api {
	@handler SystemFileUpload
	post  /api/v1/system_file/upload returns(Response)
	
	@handler SystemFileDownload
	get  /api/v1/system_file/download returns(Response)
}

// 城市树
@server(
	jwt: JwtAuth
	group: base_organ
)
service i2bill-api{
	@handler GetErpCityTree
	get /api/v1/base_organ/get_erp_city_tree returns(Response)
}

//erp 字典
@server(
	jwt: JwtAuth
	group: sys_optionset
)

service i2bill-api{
	@handler GetErpOptionset
	get /api/v1/sys_optionset/get_erp_optionset returns(Response)
}

//erp 渠道细分
@server(
	jwt: JwtAuth
	group: mkt_network_detail
)

service i2bill-api{
	@handler GetErpMktNetworkDetail
	get /api/v1/mkt_network_detail/get_erp_mkt_network_detail returns(Response)
}

//erp 收单资源校区
@server(
	jwt: JwtAuth
	group: base_organ_school
)
service i2bill-api{
	@handler GetErpSchPerm
	get /api/v1/base_organ_school/get_erp_sch_perm returns(Response)
	@handler GetErpSchTree
	get /api/v1/base_organ_school/get_organ_school_tree returns(Response)
}

//erp 校区活动
@server(
	jwt: JwtAuth
	group: mkt_active
)
service i2bill-api{
	@handler GetErpMktActive
	get /api/v1/mkt_active/get_erp_mkt_active returns(Response)
}