import {
  APIRequest,
  MessageAPIResponse,
  APIJsonEncoder,
  APIDecoder
} from '@ucap-webmessenger/api';
import { DeviceType } from '@ucap-webmessenger/core';
import { CategoryType } from '../types/category.type';
import { ContentType } from '../types/content.type';

export interface SendCopyRequest extends APIRequest {
  userSeq: number;
  deviceType: DeviceType;
  tokenKey: string;
  userName: string;
  msgId: number;
  category: CategoryType;
  title: string;
  titleYn: boolean;
  listOrder: ContentType[];
  reservationTime: string;
  smsYn: boolean;

  textContent: { text: string }[];
  recvUserList: { userSeq: number; userName: string }[];
}

export interface SendCopyResponse extends MessageAPIResponse {}

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

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