defmodule AwsSsoConfigGenerator.MixProject do
  use Mix.Project

  def project do
    [
      app: :aws_sso_config_generator,
      version: "0.4.0",
      elixir: "~> 1.18",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      releases: releases(),
      escript: [main_module: AwsSsoConfigGenerator]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    applications = [
      extra_applications: [:logger]
    ]

    if Application.get_env(:aws_sso_config_generator, :burrito) === true do
      applications ++ [mod: {AwsSsoConfigGenerator, []}]
    else
      applications
    end
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:assent, "~> 0.3"},
      {:burrito, "~> 1.0"},
      # {:aws, "~> 1.0.0", path: "./deps/aws"},
      {:aws, "~> 1.0.0"},
      {:hackney, "~> 1.18"},
      {:prompt, "~> 0.10.0"},
      {:plug, "~> 1.15"},
      {:bandit, "~> 1.4"}
    ]
  end

  def releases do
    [
      aws_sso_config_generator: [
        steps: [:assemble, &Burrito.wrap/1],
        burrito: [
          targets: [
            macos: [os: :darwin, cpu: :x86_64],
            macos_m1: [os: :darwin, cpu: :aarch64],
            linux: [os: :linux, cpu: :x86_64],
            linux_aarch64: [os: :linux, cpu: :aarch64],
            windows: [os: :windows, cpu: :x86_64]
          ]
        ]
      ]
    ]
  end
end
