# frozen_string_literal: true

module ReleaseTools
  module InternalRelease
    module Finalize
      class DedicatedNotifier < PackageAvailabilityBaseNotifier
        private

        def project
          ReleaseTools::Project::Infrastructure::GitlabDedicated::Team
        end

        def dedicated_tracker_issue
          @dedicated_tracker_issue ||=
            Retriable.with_context(:api) do
              client.issues(project, options).first
            end
        end

        def dedicated_managers
          "@o-lluch @denhams @mckgl"
        end

        def template
          File.read(
            File.expand_path('../../../../templates/dedicated_tracker_issue_note.md.erb', __dir__)
          )
        end

        def perform_notification
          notify_issue(dedicated_tracker_issue, body)
        end

        def job_type
          'Updating Dedicated tracker issue about the package availability'
        end

        def target_group
          'Dedicated'
        end
      end
    end
  end
end
