module Dalmatian
  class ClusterTest
    include Testable

    def initialize(
      cluster:,
      env:,
      helper: Helper,
      logger: Logger,
      terraform: Terraform
    )
      @cluster = cluster
      @env = env
      @helper = helper
      @logger = logger
      @terraform = terraform
    end

    private

    attr_reader :cluster, :env, :helper, :logger, :terraform

    def env_config
      env_details.merge(
        "cluster_name" => "#{cluster.name}-#{env_name}",
        "account_id" => cluster.account_id,
        "infrastructure_name" => cluster.id,
        "dalmatian_role" => "dalmatian-read",
        "environment" => env_name
      )
    end

    def checkout_revision_if_required
      false
    end

    def workspace_name
      [cluster.name, "ecs", env_name].join("-")
    end

    def target_directory
      cluster.target_directory
    end
  end
end
