import "../base.api"
import "./wx_card.api"

type (
    // The data of wx card visit information | WxCardVisit信息
    WxCardVisitInfo {
        BaseIDInfo

        // user表ID 
        UserId  *uint64 `json:"userId,optional"`

        // user名
        UserName  *string `json:"userName,optional"`

        // 被访ID 
        BotId  *uint64 `json:"botId,optional"`

        // 类型:1-微信 2-小程序 3-智能体
        BotType  *uint8 `json:"botType,optional"`

        // 类型:1-微信 2-小程序 3-智能体
        BotTypeStr  *string `json:"botTypeStr,optional"`

		CardInfo WxCardSimpleInfo `json:"cardInfo,optional,omitempty"`
    }

	WxCardVisitReq {
		BaseIDInfo

		// user表ID
		UserId  *uint64 `json:"userId,optional"`

		// 被访ID
		BotId  *uint64 `json:"botId,optional"`

		// 类型:1-微信 2-小程序 3-智能体
		BotType  *uint8 `json:"botType,optional"`
	}

	WxCardVisitSingleInfo {
		BaseIDInfo

		// user表ID
		UserId  *uint64 `json:"userId,optional"`

		// 被访ID
		BotId  *uint64 `json:"botId,optional"`

		// 类型:1-微信 2-小程序 3-智能体
		BotType  *uint8 `json:"botType,optional"`

		CardInfo WxCardInfo `json:"cardInfo,optional"`
	}

    // The response data of wx card visit list | WxCardVisit列表数据
    WxCardVisitListResp {
        BaseDataInfo

        // WxCardVisit list data | WxCardVisit列表数据
        Data WxCardVisitListInfo `json:"data"`
    }

    // WxCardVisit list data | WxCardVisit列表数据
    WxCardVisitListInfo {
        BaseListInfo

        // The API list data | WxCardVisit列表数据
        Data  []WxCardVisitInfo  `json:"data"`
    }

    // Get wx card visit list request params | WxCardVisit列表请求参数
    WxCardVisitListReq {
        PageInfo
        BotId  *uint64 `json:"botId,optional"`
        BotType  *uint8 `json:"botType,optional"`
        BotName *string `json:"botName,optional"`
    }

    // WxCardVisit information response | WxCardVisit信息返回体
    WxCardVisitInfoResp {
        BaseDataInfo

        // WxCardVisit information | WxCardVisit数据
        Data WxCardVisitInfo `json:"data"`
    }
)

@server(
	jwt: Auth
	group: wxcardvisit
	middleware: Miniprogram
)

service Wechat {
	// Create wx card visit information | 创建WxCardVisit
	@handler submitApiWxCardVisit
	post /api/card/visit (WxCardVisitInfo) returns (BaseMsgResp)

	// Get wx card visit information | 获取WxCardVisit列表
	@handler getApiWxCardVisitList
	post /api/card/visit/history (WxCardVisitListReq) returns (WxCardVisitListResp)
}

@server(
    jwt: Auth
    group: wxcardvisit
    middleware: Authority
)

service Wechat {
    // Create wx card visit information | 创建WxCardVisit
    @handler createWxCardVisit
    post /wx_card_visit/create (WxCardVisitReq) returns (BaseMsgResp)

    // Update wx card visit information | 更新WxCardVisit
    @handler updateWxCardVisit
    post /wx_card_visit/update (WxCardVisitReq) returns (BaseMsgResp)

    // Delete wx card visit information | 删除WxCardVisit信息
    @handler deleteWxCardVisit
    post /wx_card_visit/delete (IDsReq) returns (BaseMsgResp)

    // Get wx card visit list | 获取WxCardVisit列表
    @handler getWxCardVisitList
    post /wx_card_visit/list (WxCardVisitListReq) returns (WxCardVisitListResp)

    // Get wx card visit by ID | 通过ID获取WxCardVisit
    @handler getWxCardVisitById
    post /wx_card_visit (IDReq) returns (WxCardVisitInfoResp)
}
