module Video
  class VideoApprovalPage < UniversalPage
    include VideoMetadataForm
    page_url "/project/<%=params[:project_id]%>/product/<%=params[:product_id]%>/oa"

    div(:product_status, class: "OaForm-status")
    div(:content_is_approved, class: "checkbox", text: "Content is approved")
    div(:release_is_approved, class: "checkbox", text: "Release is approved")
    button(:approve_video, class: "btn-primary")
    button(:reject_video, text: "Reject Video")
    text_area(:rejection_reason, class: "OaForm-reason-rejection")
    div(:error_box, class: "VideoProductForm-error-box")
    link(:add_edit_carveouts, text: "Add/Edit Carveouts")
    link(:add_edit_exclusivity, text: "Add/Edit Exclusivity")
    link(:view_delivery_history, text: "View")
    div(:project_info, class: "OAProjectInfo")
    button(:edit_project_info) { project_info_element.button_element }
    text_area(:project_description) { project_info_element.text_area_element }
    button(:save_project_description) { project_info_element.button_element(class: "btn-primary") }

    def reject_video_submission(rejection_message)
      reject_video
      rejection_reason_element.when_present.set rejection_message
      # This one is to confirm rejection
      reject_video
    end
  end
end
