local this = class("settingAdapter_pc", require(L_R.store .. "setting.adapter.settingAdapter"))

function this:ctor()
  C_InputManager.InitializePCMode()
end

this[L_Const.settingType.resolution] = function(self, id)
end
this[L_Const.settingType.renderSet] = function(self, value)
  self:setQualityValue(value, L_Const.settingType_Render_pc)
end
this[L_Const.settingType.shadow] = function(self, value)
  self:setQualityValue(value, L_Const.settingType_Shadow_pc)
end
this[L_Const.settingType.module] = function(self, value)
  self:setQualityValue(value, L_Const.settingType_Model_pc)
end
this[L_Const.settingType.specialEffects] = function(self, value)
  self:setQualityValue(value, L_Const.settingType_Effects_pc)
end
this[L_Const.settingType.dlss] = function(self, value)
  if L_SettingStore.checkAdapter:checkState(L_Const.settingType.dlss) ~= L_Const.settingState.none then
    L_SettingStore.data.cache[L_Const.settingType.dlss] = tostring(false)
    return
  end
  local v = tostring(value) == "true"
  C_SettingUtility.OpenDlss(v)
  if not v then
    local ac = L_SettingStore:getSetData(L_Const.settingType.renderAccuracy)
    self[L_Const.settingType.renderAccuracy](self, ac or 100)
  else
    local level = L_SettingStore:getSetData(L_Const.settingType.dlssLevel)
    local levelStr = L_Const.dlssLevel[tostring(level)]
    if this.isUnder1080() then
      levelStr = "0.9"
    end
    C_DeviceGradingManager.SetQualityValue("PipelineRenderScale", levelStr)
  end
end
this[L_Const.settingType.dlssLevel] = function(self, value)
  if L_SettingStore.checkAdapter:checkState(L_Const.settingType.dlssLevel) == L_Const.settingState.none and L_SettingStore:getSetData(L_Const.settingType.dlss) == tostring(true) then
    local v = L_Const.dlssLevel[tostring(value)]
    if this.isUnder1080() then
      return
    end
    C_DeviceGradingManager.SetQualityValue("PipelineRenderScale", v)
  end
end

function this.isUnder1080()
  return C_Screen.height <= 1080
end

return this
