import { DeviceType, PushType } from '@ucap-webmessenger/core';
import {
  APIRequest,
  APIResponse,
  APIEncoder,
  APIDecoder
} from '@ucap-webmessenger/api';

export interface TokenUpdateRequest extends APIRequest {
  userSeq: string;
  deviceType: DeviceType;
  token: string;
  mobilePid?: string;
  pushType?: PushType;
}

// tslint:disable-next-line: no-empty-interface
export interface TokenUpdateResponse extends APIResponse {}

export const encodeTokenUpdate: APIEncoder<TokenUpdateRequest> = (
  req: TokenUpdateRequest
) => {
  return {
    p_user_seq: req.userSeq,
    p_device_type: req.deviceType,
    p_token: req.token,
    p_mobile_pid: req.mobilePid,
    p_push_type: req.pushType
  };
};

export const decodeTokenUpdate: APIDecoder<TokenUpdateResponse> = (
  res: any
) => {
  return {} as TokenUpdateResponse;
};
