module GraphicsElements
  class GraphicsElementPresenter
    def present(graphics_element)
      GraphicsElementData.new(
        source_file_name: graphics_element.source_file_name,
        timecode_in: graphics_element.timecode_in,
        should_toggle_checkmark: toggle_checkmark?(graphics_element),
        is_valid: graphics_element.valid?,
      )
    end

    private

    def toggle_checkmark?(graphics_element)
      graphics_element.source_file_name.present? && graphics_element.timecode_in.present?
    end

    class GraphicsElementData < Struct.new(
      :source_file_name,
      :timecode_in,
      :should_toggle_checkmark,
      :is_valid,
      keyword_init: true)
    end
  end
end
