import { EMPTY_UNIQUE_ID , entityErrorFn , entityResetFn , entityStartProcessingFn , entityStopProcessingFn , UniqueId } from '@fulls1z3/shared/util-store' ; import { AirlineAction , airlineActions } from './airline.actions' ; import { Airline , initialAirline } from './airline.model' ; import { adapter , initialState , State } from './airline.state' ; export function reducer ( state = initialState , action ) { return airlineActions . match ( { airUniversalGetManyAirlines : ( ) => entityStartProcessingFn < State > ( state ) , airUniversalGetManyAirlinesSuccess : ( airlines ) => adapter . addAll ( airlines , entityStopProcessingFn < State > ( state ) ) , airUniversalGetManyAirlinesFail : entityErrorFn < State > ( state ) , airUniversalGetOneAirline : ( ) => entityStartProcessingFn < State > ( state ) , airUniversalGetOneAirlineSuccess : ( airline ) => adapter . addOne ( airline , { ... entityStopProcessingFn < State > ( state ) , selectedId : airline . id } ) , airUniversalGetOneAirlineFail : entityErrorFn < State > ( state ) , airUniversalAddOneAirline : ( ) => adapter . addOne ( initialAirline , { ... entityStopProcessingFn < State > ( state ) , selectedId : EMPTY_UNIQUE_ID } ) , airUniversalCreateOneAirline : ( ) => entityStartProcessingFn < State > ( state ) , airUniversalCreateOneAirlineSuccess : ( airline ) => adapter . updateOne ( { id : EMPTY_UNIQUE_ID , changes : airline } , { ... entityStopProcessingFn < State > ( state ) , selectedId : undefined } ) , airUniversalCreateOneAirlineFail : entityResetFn < State > ( state ) , airUniversalUpdateOneAirline : ( ) => entityStartProcessingFn < State > ( state ) , airUniversalUpdateOneAirlineSuccess : ( airline ) => adapter . updateOne ( { id : airline . id , changes : airline } , { ... entityStopProcessingFn < State > ( state ) , selectedId : undefined } ) , airUniversalUpdateOneAirlineFail : entityResetFn < State > ( state ) , airUniversalDeleteOneAirline : ( ) => entityStartProcessingFn < State > ( state ) , airUniversalDeleteOneAirlineSuccess : ( id ) => adapter . removeOne ( id , { ... entityStopProcessingFn < State > ( state ) , selectedId : undefined } ) , airUniversalDeleteOneAirlineFail : entityResetFn < State > ( state ) , default : ( ) => state } ) ( action ) ; }