fragment TagData on Tag {
  id
  name
  sort_name
  description
  aliases
  ignore_auto_tag
  favorite
  stash_ids {
    endpoint
    stash_id
    updated_at
  }
  image_path
  scene_count
  scene_count_all: scene_count(depth: -1)
  scene_marker_count
  scene_marker_count_all: scene_marker_count(depth: -1)
  image_count
  image_count_all: image_count(depth: -1)
  gallery_count
  gallery_count_all: gallery_count(depth: -1)
  performer_count
  performer_count_all: performer_count(depth: -1)
  studio_count
  studio_count_all: studio_count(depth: -1)
  group_count
  group_count_all: group_count(depth: -1)

  parents {
    ...SlimTagData
  }

  children {
    ...SlimTagData
  }

  custom_fields
}

fragment SelectTagData on Tag {
  id
  name
  sort_name
  favorite
  description
  aliases
  image_path

  parents {
    id
    name
    sort_name
  }

  stash_ids {
    endpoint
    stash_id
    updated_at
  }
}

# Optimized fragment for tag list page - excludes expensive recursive *_count_all fields
fragment TagListData on Tag {
  id
  name
  sort_name
  description
  aliases
  ignore_auto_tag
  favorite
  stash_ids {
    endpoint
    stash_id
    updated_at
  }
  image_path
  # Direct counts only - no recursive depth queries
  scene_count
  scene_marker_count
  image_count
  gallery_count
  performer_count
  studio_count
  group_count

  parents {
    ...SlimTagData
  }

  children {
    ...SlimTagData
  }
}
