class GetMediaItemList extends DynamicUseCase {

    @Override
    protected Observable buildUseCaseObservable( Map parameters ) {

        if (!parameters.containsKey( MEDIA_KEY ) ) {

            throw new IllegalArgumentException( "Key [" + MEDIA_KEY + "] is required!" );
        }

        Media media = (Media) parameters.get( MEDIA_KEY );
        switch( media ) {

            case PROGRAM:

                return getRecordedPrograms( media, parameters );

            case RECENT:

                return this.mediaItemRepository.mediaItems( media, null );

            case UPCOMING:

                return this.mediaItemRepository.mediaItems( media, null );

            case VIDEO:

                return this.mediaItemRepository.mediaItems( media, null );

            case MOVIE:
            case HOMEVIDEO:
            case MUSICVIDEO:
            case ADULT:

                return this.mediaItemRepository.mediaItems( media, null );

            case TELEVISION:

                if( parameters.containsKey( TV_KEY ) ) {

                    return this.mediaItemRepository.mediaItems( media, null );

                } else {

                    return this.mediaItemRepository.series( media );
                }

            default :
                throw new IllegalArgumentException( "Key [" + media.name() + "] not found" );
        }

    }

    public  GetMediaItemList( final MediaItemRepository mediaItemRepository, ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread );

}