#!/usr/bin/env ruby
require 'xcodeproj'

# Open the project
project_path = 'lichunWebsocket.xcodeproj'
project = Xcodeproj::Project.open(project_path)

# Get the main target
target = project.targets.first

# Find or create the Shared/Components/Navigation group
shared_group = project.main_group.find_subpath('lichunWebsocket/Shared', true)
components_group = shared_group.find_subpath('Components', true)
navigation_group = components_group.new_group('Navigation')

# Add Navigation files
navigation_files = [
  'lichunWebsocket/Shared/Components/Navigation/LiquidGlassTabBar.swift',
  'lichunWebsocket/Shared/Components/Navigation/LiquidGlassTabContainer.swift',
  'lichunWebsocket/Shared/Components/Navigation/QuickActionsMenu.swift'
]

navigation_files.each do |file|
  file_ref = navigation_group.new_file(file)
  target.add_file_references([file_ref])
end

# Find or create the Features/Social group
features_group = project.main_group.find_subpath('lichunWebsocket/Features', true)
social_group = features_group.new_group('Social')

# Add Social file
social_file = 'lichunWebsocket/Features/Social/SocialView.swift'
social_file_ref = social_group.new_file(social_file)
target.add_file_references([social_file_ref])

# Save the project
project.save

puts "Files added successfully!"
