docs: def _GenerateApiFileDetails(path_infos):
    """Generate file details based on path infos history."""
  
    type_attrs = []
    hash_attrs = []
    size_attrs = []
    stat_attrs = []
    pathspec_attrs = []
  
    def _Value(age, value):
      """Generate ApiAff4ObjectAttributeValue from an age and a value."""
  
      v = ApiAff4ObjectAttributeValue()
      # TODO(user): get rid of RDF builtin "age" property.
      v.Set("age", age)
      # With dynamic values we first have to set the type and
      # then the value itself.
      # TODO(user): refactor dynamic values logic so that it's not needed,
      # possibly just removing the "type" attribute completely.
      v.Set("type", compatibility.GetName(value.__class__))
      v.value = value
      return v
  
    for pi in path_infos:
      if pi.directory:
        object_type = "VFSDirectory"
      else:
        object_type = "VFSFile"
  
      type_attrs.append(_Value(pi.timestamp, rdfvalue.RDFString(object_type)))
  
      if pi.hash_entry:
        hash_attrs.append(_Value(pi.timestamp, pi.hash_entry))
        size_attrs.append(
            _Value(pi.timestamp, rdfvalue.RDFInteger(pi.hash_entry.num_bytes)))
      if pi.stat_entry:
        stat_attrs.append(_Value(pi.timestamp, pi.stat_entry))
  
        if pi.stat_entry.pathspec:
          pathspec_attrs.append(_Value(pi.timestamp, pi.stat_entry.pathspec))
  
    return ApiAff4ObjectRepresentation(types=[
        ApiAff4ObjectType(
            name="AFF4Object",
            attributes=[
                ApiAff4ObjectAttribute(
                    name="TYPE",
                    values=type_attrs,
                ),
            ],
        ),
        ApiAff4ObjectType(
            name="AFF4Stream",
            attributes=[
                ApiAff4ObjectAttribute(
                    name="HASH",
                    values=hash_attrs,
                ),
                ApiAff4ObjectAttribute(
                    name="SIZE",
                    values=size_attrs,
                ),
            ],
        ),
        ApiAff4ObjectType(
            name="VFSFile",
            attributes=[
                ApiAff4ObjectAttribute(
                    name="PATHSPEC",
                    values=pathspec_attrs,
                ),
                ApiAff4ObjectAttribute(
                    name="STAT",
                    values=stat_attrs,
                ),
            ],
        ),
    ])