def _build_file_entity(
        self, item: Dict, drive_name: str, drive_id: str, download_url: Optional[str] = None
    ) -> Optional[OneDriveDriveItemEntity]:
        """Build a OneDriveDriveItemEntity from a Graph API DriveItem response.

        Returns None for items that should be skipped.
        """
        # Skip if this is a folder without downloadable content
        if "folder" in item:
            logger.info(f"Skipping folder: {item.get('name', 'Untitled')}")
            return None

        # Skip if no download URL provided
        if not download_url:
            logger.warning(f"No download URL for file: {item.get('name', 'Untitled')}")
            return None

        # Create drive breadcrumb
        drive_breadcrumb = Breadcrumb(entity_id=drive_id, name=drive_name, type="drive")

        # Extract file information
        file_info = item.get("file", {})
        parent_ref = item.get("parentReference", {})

        entity = OneDriveDriveItemEntity(
            entity_id=item["id"],
            breadcrumbs=[drive_breadcrumb],
            name=item.get("name"),
            description=None,  # Not provided in basic listing
            file=file_info,
            folder=item.get("folder"),
            parent_reference=parent_ref,
            etag=item.get("eTag"),
            ctag=item.get("cTag"),
            created_at=item.get("createdDateTime"),
            updated_at=item.get("lastModifiedDateTime"),
            size=item.get("size"),
            web_url=item.get("webUrl"),
            # Add required FileEntity fields
            file_id=item["id"],  # Use the OneDrive item ID
            download_url=download_url,  # The download URL we fetched
            mime_type=file_info.get("mimeType"),  # Extract MIME type from file info
        )

        # Add additional properties for file processing
        entity.total_size = item.get("size", 0)

        return entity
Build a OneDriveDriveItemEntity from a Graph API DriveItem response.

        Returns None for items that should be skipped.
        
backend/airweave/platform/sources/onedrive.py