syntax = "v1"

info (
	title: "产品模板底图服务"// TODO: add title
	desc: // TODO: add description
	author: ""
	email: ""
)

import "basic.api"

service product-template {
	//获取产品模板详情
	@handler GetTemplatevDetailHandler
	get /api/product-template/detail(GetTemplatevDetailReq) returns (response);
	//获取底图列表
	@handler GetBaseMapListHandler
	get /api/product-template/base-map-list(request) returns (response);
	//底图批量保存
	@handler SaveBaseMapHandler
	post /api/product-template/base-map-update(request) returns (response);
	//新增底图
	@handler AddBaseMapHandler
	post /api/product-template/base-map-add(AddBaseMapReq) returns (response);
	//更新模板
	@handler UpdateTemplateHandler
	post /api/product-template/update-template(UpdateTemplateReq) returns (response);
}

//获取产品模板详情
type GetTemplatevDetailReq {
	ModelId    int64 `form:"model_id"`
	TemplateId int64 `form:"template_id"`
}
type GetTemplatevDetailRsp {
	ProductModelInfo interface{}   `json:"product_model_info"`
	ProductTemplate  interface{}   `json:"product_template"`
	LightList        []*Light      `json:"light_list"`
	OptionModelInfo  []interface{} `json:"option_model_info"`
	Tag              int64         `json:"tag"`
}

type Tag {
	Id    int64  `json:"id"`
	Title string `json:"title"`
}

type Light {
	Id   int64       `json:"id"`
	Info interface{} `json:"info"`
}
//获取底图列表
type GetBaseMapListRsp {
	Id    int64  `json:"id"`
	Name  string `json:"name"`
	Url   string `json:"url"`
	Ctime string `json:"ctime"`
}
//保存底图信息
type SaveBaseMapReq {
	Id    int64  `json:"id"`
	Name  string `json:"name"`
	Url   string `json:"url"`
	Ctime string `json:"ctime"`
}
//新增底图
type AddBaseMapReq {
	Name string `json:"name"`
	Url  string `json:"url"`
}
//更新模板
type UpdateTemplateReq {
	ModelId      int64         `json:"modelId"`
	TemplateData *TemplateData `json:"templateData"`
}
type TemplateData {
	Id           int64                    `json:"id"`
	Name         string                   `json:"name"`
	Cover        string                   `json:"cover"`
	IsPublic     bool                     `json:"isPublic"`
	Material     string                   `json:"material"`
	MaterialList []map[string]interface{} `json:"materialList"`
}
type UpdateTemplateRsp {
	ModelId    int64 `json:"modelId"`
	TemplateId int64 `json:"templateId"`
}