package com.alterdekim.hearthhack.util;

import com.alterdekim.Protocol;
import com.google.protobuf.ByteString;

public class GameUtilities {
    public static Protocol.Notification generateNotification(int message_type, ByteString bs, int size) {
        return Protocol.Notification.newBuilder()
                .setSenderId(Protocol.EntityId.newBuilder()
                        .setHigh(144115188075855872L)
                        .setLow(0))
                .setTargetId(Protocol.EntityId.newBuilder()
                        .setHigh(144115198130930503L)
                        .setLow(78330215))
                .setType("WTCG.UtilNotificationMessage")
                .setSenderBattleTag("")
                .setSenderAccountId(Protocol.EntityId.newBuilder()
                        .setHigh(72057594037927936L)
                        .setLow(0))
                .setTargetAccountId(Protocol.EntityId.newBuilder()
                        .setHigh(72057594037927936L)
                        .setLow(437154195))
                .addAttribute(Protocol.Attribute.newBuilder()
                        .setName("message_type")
                        .setValue(Protocol.Variant.newBuilder()
                                .setIntValue(message_type)))
                .addAttribute(Protocol.Attribute.newBuilder()
                        .setName("fragment_000")
                        .setValue(Protocol.Variant.newBuilder()
                                .setBlobValue(bs)))
                .addAttribute(Protocol.Attribute.newBuilder()
                        .setName("message_size")
                        .setValue(Protocol.Variant.newBuilder()
                                .setIntValue(size)))
                .build();
    }

    public static Protocol.Notification.Builder generateSmallNotification() {
        return Protocol.Notification.newBuilder()
                .setSenderId(Protocol.EntityId.newBuilder()
                        .setHigh(144115188075855872L)
                        .setLow(0))
                .setTargetId(Protocol.EntityId.newBuilder()
                        .setHigh(144115198130930503L)
                        .setLow(78330215));
    }

    public static Protocol.Notification generateEmptyNotification(int message_type) {
        return Protocol.Notification.newBuilder()
                .setSenderId(Protocol.EntityId.newBuilder()
                        .setHigh(144115188075855872L)
                        .setLow(0))
                .setTargetId(Protocol.EntityId.newBuilder()
                        .setHigh(144115198130930503L)
                        .setLow(78330215))
                .setType("WTCG.UtilNotificationMessage")
                .setSenderBattleTag("")
                .setSenderAccountId(Protocol.EntityId.newBuilder()
                        .setHigh(72057594037927936L)
                        .setLow(0))
                .setTargetAccountId(Protocol.EntityId.newBuilder()
                        .setHigh(72057594037927936L)
                        .setLow(437154195))
                .addAttribute(Protocol.Attribute.newBuilder()
                        .setName("message_type")
                        .setValue(Protocol.Variant.newBuilder()
                                .setIntValue(message_type)))
                .addAttribute(Protocol.Attribute.newBuilder()
                        .setName("message_size")
                        .setValue(Protocol.Variant.newBuilder()
                                .setIntValue(0)))
                .build();
    }
}
