
module JamRuby
end

require_relative "./lambdas/unzipper/app.rb"


# mock event from Lambda / AWS
event = {}
event["invocationId"] = "123"
event["invocationSchemaVersion"] = "2.0"
event["job"] = {}
event["job"]["userArguments"] = {}
event["job"]["userArguments"]["mode"] = "create-jamtrack"
event["tasks"] = [{ "taskId" => "123", "s3Key" => "mapped/Ace of Base - The Sign - 10111/manifest.txt", "s3BucketName" => "jamkazam-tency-202410-test" }]
#event["tasks"] = [{ "taskId" => "123", "s3Key" => "mapped/Ace of Base - The Sign - 10111/manifest.txt", "s3BucketName" => "jamkazam-tency-202410-test" }]



#s3_manager = JamRuby::S3Manager.new('jamkazam-tency-uploads', "a", "b", "http://localhost:19090")
#manifest = "/Users/seth/workspace/tency/scripts/manifests/ace-of-base_the-sign_10111/manifest.txt"
#tmp =  "/Users/seth/workspace/jam-cloud/lambda/jamtrack-importer/tmp"
#tence_uploads_manager, working_dir, manifest_name, manifest_path
# {
#   "Environment": "dev",
#   "TencyZipsBucket": "jamkazam-tency-uploads-test",
#   "TencyJamTracksBucket": "jamkazam-tency-202410-test",
#   "EfsId": "fs-0c6e24466df585bff",
#   "VpcId": "vpc-040f8fef0c9700b58",
#   "SubnetIds": "subnet-0998ecced5ad2ed89",
#   "SgIds": "sg-02cc6ee5382e2c0ce,sg-0ff99640a2871ac4c",
#   "MountPath": "/tmp",
#   "JamTrackContainerPath": "jamtrack-lambda:1.0.0",
#   "DbName": "jam",
#   "DbHost": "example.com",
#   "DbPass": "seth",
#   "DbUser": "seth"
# }

# Parse JSON into a Ruby hash
config = File.open("../../env/local.json") do |file|
  JSON.load(file)
end
# Load each key-value pair into ENV
config.each do |key, value|
  puts "KEY #{key} VALUE #{value}"
  ENV[key] = value
end

ENV["AWS_BUCKET"] = "jamkazam-dev"
ENV["AWS_BUCKET_PUBLIC"] = "jamkazam-dev-public"
ENV["DB_HOST"] = nil
ENV["DB_USER"] = "seth"
ENV["DB_NAME"] = "jam"
ENV["END_ON_FAIL"] = "1"
ENV["TENCY_ZIPS_BUCKET"] = "jamkazam-tency-uploads-test"
ENV["TENCY_JAMTRACKS_BUCKET"] = "jamkazam-tency-202410-test"
ENV["FFMPEG_PATH"] = "/Users/seth/workspace/jkclient-osx-build/ffmpeg/ffmpeg"
ENV["FFMPEG_PATH_MP3"] = "/Users/seth/bin/ffmpeg"
ENV["JMEP_DIR"] = "/Users/seth/workspace/jmep"
lambda_handler(event:event, context:nil)

