import { Dispatch } from 'react'; import { IdentifiedAddress } from '@gecogvidanto/shared'; /** * The state used for the component. */ interface State { locationName?: string; address?: IdentifiedAddress | string; roundsPerSet: number; roundLength: number; locationNameValid: boolean; sending: boolean; } /** * The target component names. */ export declare const enum TargetName { LocationName = "location-name", Address = "address", RoundsPerSet = "rounds-per-set", RoundLength = "round-length" } /** * Type of actions which can be applied to the state. */ declare const enum ActionType { UpdateValue = 0, UpdateValidation = 1, SetSending = 2 } /** * Update string field value. */ interface UpdateStringValueAction { type: ActionType.UpdateValue; target: TargetName.LocationName; payload: string; } /** * Update address field value. */ interface UpdateAddressValueAction { type: ActionType.UpdateValue; target: TargetName.Address; payload: string | IdentifiedAddress; } /** * Update unknown field value. */ interface UpdateUnknownValueAction { type: ActionType.UpdateValue; target: TargetName.RoundsPerSet | TargetName.RoundLength; payload: unknown; } /** * All update actions. */ declare type UpdateValueAction = UpdateStringValueAction | UpdateAddressValueAction | UpdateUnknownValueAction; /** * Build an action used to update the (location name) field value. * * @param target - The target component for which to update value. * @param value - The value to set. * @returns The corresponding action. */ export declare function updateValue(target: TargetName.LocationName, value: string): UpdateStringValueAction; /** * Build an action used to update the (address) field value. * * @param target - The target component for which to update value. * @param value - The value to set. * @returns The corresponding action. */ export declare function updateValue(target: TargetName.Address, value: string | IdentifiedAddress): UpdateAddressValueAction; /** * Build an action used to update the (rounds) field value. * * @param target - The target component for which to update value. * @param value - The value to set. * @returns The corresponding action. */ export declare function updateValue(target: TargetName.RoundsPerSet | TargetName.RoundLength, value: unknown): UpdateUnknownValueAction; /** * Update validation action. */ interface UpdateValidationAction { type: ActionType.UpdateValidation; target: string; payload: boolean; } /** * Build an action used to update the validation status. * * @param target - The target component for which to update validation state. * @param value - The value to set. * @returns The corresponding action. */ export declare function updateValidation(target: TargetName, value: boolean): UpdateValidationAction; /** * Send action. */ interface SetSendingAction { type: ActionType.SetSending; payload: boolean; } /** * Build an action used to set the sending status. * * @param sending - The sending status. * @returns The corresponding action. */ export declare function setSending(sending: boolean): SetSendingAction; /** * The reducer action. */ declare type Action = UpdateValueAction | UpdateValidationAction | SetSendingAction; /** * Use the component reducer. * * @returns The same values as for `React.useReducer`. */ export default function useNewReducer(): [State, Dispatch]; export {};