export type MobilePushPlatform = 'ios' | 'android';

export interface PushDeviceTokenRegistrationInput {
  userId: string;
  token: string;
  platform: MobilePushPlatform;
}

export interface PushDeviceTokenRegistrationPayload {
  userId: string;
  token: string;
  platform: MobilePushPlatform;
}

export function normalizePushPlatform(platform: string): MobilePushPlatform | null {
  if (platform === 'ios' || platform === 'android') {
    return platform;
  }

  return null;
}

export function buildPushDeviceTokenRegistrationPayload(
  input: PushDeviceTokenRegistrationInput
): PushDeviceTokenRegistrationPayload {
  return {
    userId: input.userId,
    token: input.token,
    platform: input.platform
  };
}
