package net.ranides.assira.observable;

import java.util.Collection;
import java.util.List;

public interface ListEvent<T> extends CollectionEvent<T> {

    default List<T> list() {
        return (List<T>) collection();
    }

    class Remove<T> extends CollectionEvent.Remove<T> implements ListEvent<T> {
        protected Remove(List<T> list, T value) {
            super(list, value);
        }
    }

    class RemoveMany<T> extends CollectionEvent.RemoveMany<T> implements ListEvent<T> {
        protected RemoveMany(List<T> list, Collection<T> values) {
            super(list, values);
        }
    }

    class Clear<T> extends CollectionEvent.Clear<T> implements ListEvent<T> {
        protected Clear(List<T> list) {
            super(list);
        }
    }

    class Set<T> extends CollectionEvent.Set<T> implements ListEvent<T> {
        protected Set(List<T> list, T previous, T value) {
            super(list, previous, value);
        }
    }

    class Add<T> extends CollectionEvent.Add<T> implements ListEvent<T> {
        protected Add(List<T> list, T value) {
            super(list, value);
        }
    }

    class AddMany<T> extends CollectionEvent.AddMany<T> implements ListEvent<T> {
        protected AddMany(List<T> list, Collection<? extends T> values) {
            super(list, values);
        }
    }
}
