local this = class("pageDoAction", G_UIPageBase)
local poseTpl = L_GameTpl:getPoseTpl()

function this.bind()
  return {action_name = "", status_value = 0}
end

function this.methods()
  return {
    onClick_closePage = function(self)
      L_GameUtil.showCommonTip({
        txtContent = L_WordsTpl:getValue("notice_homeProduction_35"),
        confirmCallback = function()
          L_PlayerStore:req_cancelPose(function()
            L_UI:close(self.pageName)
          end)
        end
      })
    end,
    onClick_cancel = function(self)
      L_GameUtil.showCommonTip({
        txtContent = L_WordsTpl:getValue("notice_homeProduction_35"),
        confirmCallback = function()
          L_PlayerStore:req_cancelPose(function()
            L_UI:close(self.pageName)
          end)
        end
      })
    end
  }
end

function this:preOpen(options)
  self.data = options
  if options and options.pose_id then
    local action_name = poseTpl:getName(poseTpl:getTplById(options.pose_id))
    self.bind.action_name = action_name
  end
  self.data.startTime = 0
  self.bind.status_value = 0
  self.data.duration = 3
end

function this:show(options)
end

function this:update()
  if self.data.startTime < self.data.duration then
    self.data.startTime = C_Time.deltaTime + self.data.startTime
    self.bind.status_value = self.data.startTime / self.data.duration
  end
end

function this:close(options)
  this.super.close(self, options)
end

return this
