# frozen_string_literal: true

module Neetob
  class CLI
    module MonthlyAudit
      module Misc
        class SslCertsSetupForAutoRenewal < CLI::Base
          def initialize
            super()
          end

          def run
            domains_data = [["Domain", "Listed on certmanager", "Comments", "Audit Passed"]]
            ui.info("\n", print_to_audit_log: false)
            ui.info "#### Please manually check and add Yes/No for all the following checks on https://certmanager.neeto.com for the domains listed in the table below:"
            ui.info "- Check whether the certificate for the domain is listed on certmanager"
            ui.info "- Finally, set Audit Passed as Yes only if certificate for the domain is listed, otherwise set it as No, and add a comment in the Comments column"
            ui.info("\n")
            Neetob::CLI::Cloudflare::Base::ZONE_IDS.keys
              .select { |domain| domain.to_s.include?(".com") }
              .reject { |domain| ["neeto.com", "bigbinary.com"].include?(domain.to_s) }
              .map do |domain|
              domains_data << [domain, nil, nil, nil]
            end
            ui.print_table(domains_data)
          end
        end
      end
    end
  end
end