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 EditReservationRequest extends APIRequest {
  userSeq: number;
  deviceType: DeviceType;
  tokenKey: 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 EditReservationResponse extends MessageAPIResponse {}

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

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