package com.yutou.biliapi.bean.websocket.live;

import com.alibaba.fastjson2.JSONObject;
import com.yutou.common.utils.Log;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 大航海购买
 * <a href="https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/live/message_stream.md#%E4%B8%8A%E8%88%B0%E9%80%9A%E7%9F%A5">上舰通知</a>
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class WSGuardBuy extends WSData{
    private String uid;
    private String username;
    private long guardLevel;
    private long num;
    private long price;
    private long giftID;
    private String giftName;
    private long startTime;
    private long endTime;

    public static void main(String[] args) {
        JSONObject json=JSONObject.parseObject("{\"cmd\":\"GUARD_BUY\",\"data\":{\"uid\":5427372,\"username\":\"李湜渰\",\"guard_level\":3,\"num\":1,\"price\":198000,\"gift_id\":10003,\"gift_name\":\"舰长\",\"start_time\":1724985039,\"end_time\":1724985039}}");
        WSGuardBuy wsguardBuy = new WSGuardBuy(json);
        Log.i(wsguardBuy);
    }
    public WSGuardBuy(JSONObject json) {
        super(json);
        JSONObject data = json.getJSONObject("data");
        uid = data.getString("uid");
        username = data.getString("username");
        guardLevel = data.getLong("guard_level");
        num = data.getLong("num");
        price = data.getLong("price");
        giftID = data.getLong("gift_id");
        giftName = data.getString("gift_name");
        startTime = data.getLong("start_time");
        endTime = data.getLong("end_time");
    }
}
