package com.alterdekim.hearthhack.component.processor.client.request;

import com.alterdekim.Protocol;
import com.alterdekim.hearthhack.component.TcpConnection;
import com.alterdekim.hearthhack.util.BattleNetPacket;
import com.alterdekim.hearthhack.util.ClientRequestBody;
import com.alterdekim.hearthhack.util.Util;

public class BattlePayConfig extends ClientRequestParser {
    @Override
    public void parse(BattleNetPacket packet, ClientRequestBody body, TcpConnection conn) throws Exception {
        /*Protocol.BattlePayConfigResponse configResponse = Protocol.BattlePayConfigResponse.newBuilder()
                .setCurrency(4)
                .setUnavailable(false)
                .build();

        Protocol.Notification n = generateNotification(238, configResponse.toByteString(), configResponse.getSerializedSize());*/

        byte[] b = Util.hexStringToByteArray("[encoded data, 20806 characters]");

        Protocol.Header header = Protocol.Header.newBuilder()
                .setServiceId(4)
                .setMethodId(1)
                .setToken(conn.nextToken())
                .setObjectId(0)
                .setSize(b.length) // n.getSerializedSize()
                .setStatus(0)
                .build();

        conn.send(new BattleNetPacket(header, b)); // n.toByteArray()
    }

    @Override
    public int getId() {
        return 237;
    }
}
