import abc
import logging
from encoder.node2vec_encoder import Node2Vec
from encoder.vae_encoder import VGAEEncoder, VGAEDecoder, VGAE



class EncoderFactory:

    def __init__(self):
        pass
    def get_encoder(self, config, data=None):
        if config.encoder_model == 'gcn':
            logging.info('GCN is selected as encoder.')
        elif config.encoder_model == 'node2vec':
            logging.info('Node2Vec is selected as encoder.')
            return Node2Vec(data, config)   
        elif config.encoder_model == "vae":
            logging.info('Variational autoencoder is selected as encoder.')
            encoder = VGAEEncoder(config)
            if config.encoder.vae.decoder == "custom":
                decoder = VGAEDecoder(config)
            else:
                decoder = None
            return VGAE(encoder, decoder)
        else:
            logging.error('No such encoder name as ' + config.encoder_model)
            raise ValueError('Define the encoder')