using Xamarin.Forms;
using System;
using System.ComponentModel;

namespace CupWorks.Forms.Fluent
{
    public static class TimePickerExtension
    {
        public static TSelf ChangeTimePickerFormat<TSelf>(this TSelf self, string format) where TSelf : TimePicker
        {
            self.Format = format;
            return self;
        }
        
        public static TSelf ChangeTime<TSelf>(this TSelf self, TimeSpan time) where TSelf : TimePicker
        {
            self.Time = time;
            return self;
        }
        
        public static TSelf HandleTimePickerChildrenReordered<TSelf>(this TSelf self, EventHandler childrenReordered) where TSelf : TimePicker
        {
            self.ChildrenReordered += childrenReordered;
            return self;
        }
        
        public static TSelf HandleTimePickerSizeChanged<TSelf>(this TSelf self, EventHandler sizeChanged) where TSelf : TimePicker
        {
            self.SizeChanged += sizeChanged;
            return self;
        }
        
        public static TSelf HandleTimePickerMeasureInvalidated<TSelf>(this TSelf self, EventHandler measureInvalidated) where TSelf : TimePicker
        {
            self.MeasureInvalidated += measureInvalidated;
            return self;
        }
        
        public static TSelf HandleTimePickerFocused<TSelf>(this TSelf self, EventHandler<FocusEventArgs> focused) where TSelf : TimePicker
        {
            self.Focused += focused;
            return self;
        }
        
        public static TSelf HandleTimePickerUnfocused<TSelf>(this TSelf self, EventHandler<FocusEventArgs> unfocused) where TSelf : TimePicker
        {
            self.Unfocused += unfocused;
            return self;
        }
        
        public static TSelf HandleTimePickerChildAdded<TSelf>(this TSelf self, EventHandler<ElementEventArgs> childAdded) where TSelf : TimePicker
        {
            self.ChildAdded += childAdded;
            return self;
        }
        
        public static TSelf HandleTimePickerChildRemoved<TSelf>(this TSelf self, EventHandler<ElementEventArgs> childRemoved) where TSelf : TimePicker
        {
            self.ChildRemoved += childRemoved;
            return self;
        }
        
        public static TSelf HandleTimePickerDescendantAdded<TSelf>(this TSelf self, EventHandler<ElementEventArgs> descendantAdded) where TSelf : TimePicker
        {
            self.DescendantAdded += descendantAdded;
            return self;
        }
        
        public static TSelf HandleTimePickerDescendantRemoved<TSelf>(this TSelf self, EventHandler<ElementEventArgs> descendantRemoved) where TSelf : TimePicker
        {
            self.DescendantRemoved += descendantRemoved;
            return self;
        }
        
        public static TSelf HandleTimePickerPropertyChanging<TSelf>(this TSelf self, PropertyChangingEventHandler propertyChanging) where TSelf : TimePicker
        {
            self.PropertyChanging += propertyChanging;
            return self;
        }
        
        public static TSelf HandleTimePickerPropertyChanged<TSelf>(this TSelf self, PropertyChangedEventHandler propertyChanged) where TSelf : TimePicker
        {
            self.PropertyChanged += propertyChanged;
            return self;
        }
        
        public static TSelf HandleTimePickerBindingContextChanged<TSelf>(this TSelf self, EventHandler bindingContextChanged) where TSelf : TimePicker
        {
            self.BindingContextChanged += bindingContextChanged;
            return self;
        }
    }
}