import {
  APIRequest,
  APIResponse,
  APIDecoder,
  APIJsonEncoder,
  MessageAPIResponse
} from '@ucap-webmessenger/api';
import { DeviceType } from '@ucap-webmessenger/core';
import { MessageType } from '../types/message.type';

export interface DelRequest extends APIRequest {
  userSeq: number;
  deviceType: DeviceType;
  tokenKey: string;
  type: MessageType;

  msgList: { msgId: number }[];
}

export interface DelResponse extends MessageAPIResponse {}

export const encodeDel: APIJsonEncoder<DelRequest> = (req: DelRequest) => {
  return JSON.stringify(req);
};

export const decodeDel: APIDecoder<DelResponse> = (res: any) => {
  return {
    responseCode: res.responseCode,
    responseMsg: res.responseMsg
  } as DelResponse;
};
