using UnityEngine.Rendering.Universal;

namespace UnityEditor.Rendering.Universal
{
    [VolumeComponentEditor(typeof(Blur))]
    sealed class BlurEditor : VolumeComponentEditor
    {
        //SerializedDataParameter m_Mode;
        SerializedDataParameter m_Intensity;
        SerializedDataParameter m_downSampleNum;
        SerializedDataParameter m_blurIterations;
        SerializedDataParameter m_color;

        public override void OnEnable()
        {
            var o = new PropertyFetcher<Blur>(serializedObject);

            m_Intensity = Unpack(o.Find(x => x.intensity));
            m_downSampleNum = Unpack(o.Find(x => x.downSampleNum));
            m_blurIterations = Unpack(o.Find(x => x.blurIterations));
            m_color = Unpack(o.Find(x => x.color));
        }

        public override void OnInspectorGUI()
        {
            if (UniversalRenderPipeline.asset?.postProcessingFeatureSet == PostProcessingFeatureSet.PostProcessingV2)
            {
                EditorGUILayout.HelpBox(UniversalRenderPipelineAssetEditor.Styles.postProcessingGlobalWarning, MessageType.Warning);
                return;
            }

            PropertyField(m_Intensity);
            PropertyField(m_downSampleNum);
            PropertyField(m_blurIterations);
            PropertyField(m_color);
        }
    }
}
