import { ApiPageResponseAttributes } from 'src/application/models/api/responseGenerics';

export const isApiPageResponseAttributes = (obj: unknown): obj is ApiPageResponseAttributes => {
  if (obj == null || typeof obj !== 'object') {
    return false;
  }

  if ('title' in obj && obj.title != null && typeof obj.title !== 'string') {
    return false;
  }

  if ('description' in obj && typeof obj.description !== 'string') {
    return false;
  }

  if ('url' in obj && typeof obj.url !== 'string') {
    return false;
  }

  return true;
};
