package dto

type WechatOAuthRequest struct {
	Code string `json:"code" validate:"required" required:"true" description:"微信授权码"`
}

type WechatOAuthResponse struct {
	AccessToken string                    `json:"access_token" description:"访问令牌"`
	ExpiresIn   int64                     `json:"expires_in" description:"令牌有效期(秒)"`
	Customer    *PersonalCustomerResponse `json:"customer" description:"客户信息"`
}

type WechatPayJSAPIRequest struct {
	OpenID string `json:"openid" validate:"required" required:"true" description:"用户OpenID"`
}

type WechatPayJSAPIResponse struct {
	PrepayID  string                 `json:"prepay_id" description:"预支付交易会话标识"`
	PayConfig map[string]interface{} `json:"pay_config" description:"JSSDK支付配置"`
}

type FuiouPayJSAPIResponse struct {
	AppID     string `json:"app_id" description:"应用ID"`
	TimeStamp string `json:"time_stamp" description:"时间戳"`
	NonceStr  string `json:"nonce_str" description:"随机字符串"`
	Package   string `json:"package" description:"预支付参数包"`
	SignType  string `json:"sign_type" description:"签名类型"`
	PaySign   string `json:"pay_sign" description:"支付签名"`
}

type WechatPayH5Request struct {
	SceneInfo WechatH5SceneInfo `json:"scene_info" validate:"required" required:"true" description:"场景信息"`
}

type WechatH5SceneInfo struct {
	PayerClientIP string         `json:"payer_client_ip" validate:"required,ip" required:"true" description:"用户终端IP"`
	H5Info        WechatH5Detail `json:"h5_info" description:"H5场景信息"`
}

type WechatH5Detail struct {
	Type string `json:"type" validate:"omitempty,oneof=iOS Android Wap" description:"场景类型 (iOS:苹果, Android:安卓, Wap:浏览器)"`
}

type WechatPayH5Response struct {
	H5URL string `json:"h5_url" description:"微信支付跳转URL"`
}

type WechatPayJSAPIParams struct {
	ID uint `path:"id" description:"订单ID" required:"true"`
	WechatPayJSAPIRequest
}

type WechatPayH5Params struct {
	ID uint `path:"id" description:"订单ID" required:"true"`
	WechatPayH5Request
}

// JSSDKConfigRequest 获取 JSSDK 签名配置请求
type JSSDKConfigRequest struct {
	URL string `query:"url" validate:"required" required:"true" description:"当前页面完整 URL（含协议和路径，不含 # 及其后内容）"`
}

// JSSDKConfigResponse JSSDK 签名配置响应
// 前端使用这些字段调用 wx.config() 初始化微信 JS-SDK
type JSSDKConfigResponse struct {
	AppID     string `json:"app_id" description:"公众号 AppID"`
	Timestamp int64  `json:"timestamp" description:"时间戳（秒）"`
	NonceStr  string `json:"nonce_str" description:"随机字符串"`
	Signature string `json:"signature" description:"签名（SHA1）"`
}

// WechatAppIDResponse 微信 AppID 响应
type WechatAppIDResponse struct {
	AppID string `json:"app_id" description:"当前生效的公众号 AppID"`
}
