syntax = "proto3";

message Request {
  string id = 1;
  repeated RequestImp imp = 2;
  RequestDevice device = 3;
  RequestApp app = 4;
  RequestUser user = 5;
  RequestSite site = 6;
  int64 timeout = 7;
  bool debug = 8;
  int32 secure = 9;
}

message RequestImp {
  string id = 1;
  float bid_floor = 2;
  string slot_id = 3;
  int32 slot_type = 4;
  repeated RequestImpSize size = 5;
  repeated RequestImpDeal deals = 6;
  int32 minduration = 7;
  int32 maxduration = 8;
  repeated int32 template_id = 9;
  repeated int32 support_action = 10;
}

message RequestImpSize {
  int32 w = 1;
  int32 h = 2;
}

message RequestUser {
  string gender = 1;
  string age = 2;
  repeated string install_app = 3;
}

message RequestSite {
  string name = 1;
  string domain = 2;
  string page = 3;
  string ref = 4;
}

message RequestImpDeal {
  string id = 1;
  int32 bid_floor = 2;
}

message RequestDevice {
  string ip = 1;
  string ua = 2;
  int32 devicetype = 3;
  int32 h = 4;
  int32 w = 5;
  int32 orientation = 6;
  RequestDeviceGeo geo = 7;
  string make = 8;
  string vendor = 9;
  string model = 10;
  int32 carrier = 11;
  uint32 connection_type = 12;
  int32 os = 13;
  string osv = 14;
  string mac = 15;
  string mac_md5 = 16;
  string imei = 17;
  string imei_md5 = 18;
  string oaid = 19;
  string oaid_md5 = 20;
  string idfa = 21;
  string idfa_md5 = 22;
  string android_id = 23;
  string android_id_md5 = 24;
  string paid = 25;
  string caid = 26; // CAID值
  string caid_version = 27;  // CAID版本号
  string caid_md5 = 28; // CAID值MD5
  string boot_mark = 29;
  string update_mark = 30;
  string boot_time = 31;
  string update_time = 32;
  string vercode_ag = 33;
  string vercode_hms = 34;
  string country_code = 35;
  // 磁盘总空间, 单位KB
  int64 disk_total = 36;
  // 系统总内存空间, 单位KB
  int64 mem_total = 37;
  // 设备名称的
  string device_name = 38;
  string hardware_machine = 39;
  // 语言
  string language = 40;
  // 时区, 单位: 秒
  string time_zone = 41;
  // 设备像素密度系数
  double density = 42;
  // 每英寸所拥有的像素数量
  int32 ppi = 43;
  // 设备每英寸的点数
  int32 dpi = 44;
  // 系统初始化时间
  string birth_time = 45;
  repeated CaidInfo caids = 46; // 多版本CAID信息
}

message RequestDeviceGeo {
  float lat = 1;
  float lon = 2;
}

message CaidInfo {
  // CAID版本
  string version = 1;
  // CAID原值
  string caid = 2;
}

message RequestApp {
  string appid = 1;
  string name = 2;
  string bundle = 3;
  string version = 4;
}

message Response {
  string id = 1;
  int32 code = 2;
  string msg = 3;
  repeated ResponseSeatBid seat_bid = 4;
  string bidid = 5;
  int64 cold_end_time = 6; // 设备冷却结束时间，unix时间戳，单位是：秒
}

message ResponseSeatBid {
  string seat = 1;
  repeated ResponseBid bid = 2;
}

message ResponseBid {
  string id = 1;
  string imp_id = 2;
  int32 support_action = 3;
  string creative_id = 4;
  int32 price = 5;
  string deal_id = 6;
  string nurl = 7;
  ResponseBidApp app = 8;
  ResponseBidNative native = 9;
  ResponseBidTrack tracking = 10;
  string lurl = 11;
  ResponseExtInfo ext_info = 99;
}

message ResponseExtInfo {
  string  x_request_with_package_name = 1;
  string  x_user_agent = 2;
  string  replaced_host = 3;
  string  delivery_type = 4;
}

message ResponseBidNative {
  int32 template_id = 1;
  repeated ResponseBidNativeAsset assets = 2;
}

message ResponseBidNativeAsset {
  ResponseBidNativeImg image = 1;
  ResponseBidNativeVideo video = 2;
  ResponseBidNativeData data = 3;
}

message ResponseBidNativeImg {
  int32 type = 1;
  string url = 2;
  int32 w = 3;
  int32 h = 4;
}

message ResponseBidNativeVideo {
  string url = 1;
  int32 w = 2;
  int32 h = 3;
  int32 duration = 4;
  string cover_url = 5;
}

message ResponseBidNativeData {
  int32 type = 1;
  string value = 2;
}

message ResponseBidApp {
  string name = 1;
  string package_name = 2;
  string app_version = 3;
  string developer = 4;
  string app_permission = 5;
  string app_privacy = 6;
  string app_desc = 7;
  string app_desc_url = 8;
  string app_icon = 9;
  string app_id = 10;
  int64 app_size = 11; // 应用大小, 单位KB
  string download_url = 12; // 下载地址
}

message ResponseBidTrack {
  string landing_page = 1; // 落地页
  string deep_link = 2;
  string wx_program_id = 3;
  string wx_program_path = 4;
  repeated string imp_trackers = 5;
  repeated string clk_trackers = 6;
  repeated string deeplink_trackers = 7;
  repeated string download_start = 8;
  repeated string download_end = 9;
  repeated string install_start = 10;
  repeated string install_end = 11;
  repeated string video_start_play = 12;
  repeated string video_25_play = 13;
  repeated string video_50_play = 14;
  repeated string video_75_play = 15;
  repeated string video_end_play = 16;
  repeated string video_close = 17;
  repeated string deeplink_failed_trackers = 18;
  repeated string deeplink_reject_trackers = 19;
}
