package com.saki.qq.wtlogin.pack.send;

import com.saki.encode.Canvart;
import com.saki.qq.global.App;
import com.saki.qq.global.Device;
import com.saki.qq.global.Global;
import com.saki.qq.global.Key;
import com.saki.qq.global.Token;
import com.saki.qq.wtlogin.pack.Pack;
import com.saki.qq.wtlogin.pack.protobuff.ProtoBuff;

public class OidbSvc {

    public static class Ox496 extends T0B01 {

        public Ox496(int seq) {
            super("OidbSvc.0x496");
            setSeq(seq);
        }

        @Override
        protected byte[] getContent() {
            return Canvart.Hex2Byte("08 96 09 10 00 22 04 20 01 28 01");
        }

    }

    // 成员禁言
    public static class Ox570_8 extends T0B01 {

        private long groupid;
        private long uin;
        private int time;

        public Ox570_8(int seq, long group, long uin, int time) {
            super("OidbSvc.0x570_8");
            setSeq(seq);
            this.groupid = group;
            this.uin = uin;
            this.time = time;
        }

        @Override
        protected byte[] getContent() {
            Pack p = new Pack();
            p.appendLong(groupid);
            p.appendByte(0x20);
            p.appendShort(1);
            p.appendLong(uin);
            p.appendInt(time);
            byte[] bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeVarint(1, 1392));
            p.appendBytes(ProtoBuff.writeVarint(2, 8));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeLengthDelimt(4, bin));
            return p.getAll();
        }

    }

    public static class Ox59f extends SendPack {
        public Ox59f(int seq) {
            super("OidbSvc.0x59f");
            setSeq(seq);
            setRequestId(seq);
            setToken44(Token.T0044);
            setToken4c(Token.T004C);
            setAppsub(App.SUBAPP);
            setImei(Device.IMEI);
            setVersion(App.PACKVERSION);
        }

        @Override
        protected byte[] getContent() {
            return Canvart
                    .Hex2Byte("08 9F 0B 10 01 18 00 22 00 32 0D 61 6E 64 72 6F 69 64 20 36 2E 35 2E 30");
        }

        @Override
        protected byte[] UsedKey() {
            return Key.KSESSION;
        }
    }

    public static class Ox7a2_0 extends T0B01 {

        public Ox7a2_0(int seq) {
            super("OidbSvc.0x7a2_0");
            setSeq(seq);
        }

        @Override
        protected byte[] getContent() {
            Pack p = new Pack();
            p.appendBytes(ProtoBuff.writeVarint(1, 1954));
            p.appendBytes(ProtoBuff.writeVarint(2, 0));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeLengthDelimt(4,
                    ProtoBuff.writeVarint(1, 0)));
            return p.getAll();
        }

    }

    public static class Ox7c4_0 extends T0B01 {

        public Ox7c4_0(int seq) {
            super("OidbSvc.0x7c4_0");
            setSeq(seq);
        }

        @Override
        protected byte[] getContent() {
            Pack p = new Pack();
            p.appendBytes(ProtoBuff.writeVarint(1, Global.qq));
            p.appendBytes(ProtoBuff.writeVarint(2, 0));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeVarint(4, 100));
            byte[] bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeLengthDelimt(2, bin));
            p.appendBytes(ProtoBuff.writeVarint(3, 2));
            bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeVarint(1, 1988));
            p.appendBytes(ProtoBuff.writeVarint(2, 0));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeLengthDelimt(4, bin));
            return p.getAll();
        }

    }

    // 全体禁言
    public static class Ox89a_0 extends T0B01 {

        private long groupid;
        private boolean shutup;

        public Ox89a_0(int seq, long group, boolean shutup) {
            super("OidbSvc.0x89a_0");
            setSeq(seq);
            this.groupid = group;
            this.shutup = shutup;
        }

        @Override
        protected byte[] getContent() {
            Pack p = new Pack();
            p.appendBytes(ProtoBuff.writeVarint(1, groupid));
            p.appendBytes(ProtoBuff.writeLengthDelimt(2,
                    ProtoBuff.writeVarint(17, shutup ? 268435455 : 0)));
            byte[] bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeVarint(1, 2202));
            p.appendBytes(ProtoBuff.writeVarint(2, 0));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeLengthDelimt(4, bin));
            return p.getAll();
        }

    }

    // 移除成员
    public static class Ox8a0_0 extends T0B01 {

        private long id;
        private long gid;

        public Ox8a0_0(int seq, long gid, long id) {
            super("OidbSvc.0x8a0_0");
            setSeq(seq);
            this.id = id;
            this.gid = gid;
        }

        @Override
        protected byte[] getContent() {
            Pack p = new Pack();
            p.appendBytes(ProtoBuff.writeVarint(1, 5));
            p.appendBytes(ProtoBuff.writeVarint(2, id));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            byte[] bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeVarint(1, gid));
            p.appendBytes(ProtoBuff.writeLengthDelimt(2, bin));
            bin = p.getAll();
            p.clear();
            p.appendBytes(ProtoBuff.writeVarint(1, 2208));
            p.appendBytes(ProtoBuff.writeVarint(2, 0));
            p.appendBytes(ProtoBuff.writeVarint(3, 0));
            p.appendBytes(ProtoBuff.writeLengthDelimt(4, bin));
            return p.getAll();
        }

    }
}
