import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
import {
  ProtocolRequest,
  ProtocolResponse,
  ProtocolEncoder,
  PacketBody,
  PacketBodyValue,
  ProtocolDecoder,
  ProtocolMessage
} from '@ucap-webmessenger/protocol';

export interface GroupDelRequest extends ProtocolRequest {
  // 0: 동료그룹SEQ(n)
  groupSeq: number;
}

export interface GroupDelResponse extends ProtocolResponse {
  // 0: 동료그룹SEQ(n)
  groupSeq: number;
}

export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
  req: GroupDelRequest
) => {
  const bodyList: PacketBody[] = [];

  bodyList.push({ type: PacketBodyValue.Integer, value: req.groupSeq });

  return bodyList;
};

export const decodeGroupDel: ProtocolDecoder<GroupDelResponse> = (
  message: ProtocolMessage
) => {
  return {
    groupSeq: message.bodyList[0]
  } as GroupDelResponse;
};
