module Project
  class DigitalProductBasePage < BasePage
    include Project::ProductSidebar
    # Class containing the sidebar and headers for digital product builder.
    # This reduces the size of other pages by removing unnecessary extensions.

    INCOMPLETE_ICON_CLASS = "Icons-attention".freeze

    svg(:incomplete_icon, class: INCOMPLETE_ICON_CLASS)
    button(:save, id: "digital-product-footer-next-button")
    div(:loading_dots, class: "LoadingIndicator")

    def step_has_error?(step_name)
      send("#{step_name}_step_element").svg_element(class: INCOMPLETE_ICON_CLASS).element.present?
    end

    def wait_for_completeness_check
      # TODO: change to green checkmark when territory restriction icon is fixed
      incomplete_icon_element.when_present
    end
  end
end
