using DiplomovaPrace.Web.Admin.Store.DeliveryTypeUseCase.Actions;
using Fluxor;

namespace DiplomovaPrace.Web.Admin.Store.DeliveryTypeUseCase
{
	public static class Reducers
	{
		[ReducerMethod]
		public static DeliveryTypeState RequestDeliveryTypesAction(DeliveryTypeState state, RequestDeliveryTypesAction action) =>
			new(
				isLoading: true,
				deliveryTypes: null);

		[ReducerMethod]
		public static DeliveryTypeState ReceiveDeliveryTypesAction(DeliveryTypeState state, ReceiveDeliveryTypesAction action)
		{
			return new DeliveryTypeState(
				isLoading: false,
				deliveryTypes: action.DeliveryTypes);
		}
	}
}
