package be.iminds.ilabt.jfed.lowlevel.user;

import be.iminds.ilabt.jfed.fedmon.webapi.service.json.Server;
import be.iminds.ilabt.jfed.lowlevel.authority.AuthorityFinder;
import be.iminds.ilabt.jfed.util.GeniUrn;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * User: twalcari
 * Date: 7/14/2016
 * Time: 16:24
 */
public class ManualUserLoginInfo extends AbstractUserLoginInfo {

    ManualUserLoginInfo(@Nullable String keyCertContent, GeniUserFactory geniUserFactory, AuthorityFinder authorityFinder) {
        super(keyCertContent, geniUserFactory, authorityFinder);
    }

    ManualUserLoginInfo(@Nullable String keyCertContent, @Nullable GeniUrn userUrn,
                        @Nullable Server userAuthority, GeniUserFactory geniUserFactory) {
        super(keyCertContent, userUrn, userAuthority, geniUserFactory);
    }

    ManualUserLoginInfo(@Nonnull UserLoginInfo userLoginInfo, GeniUserFactory geniUserFactory) {
        super(userLoginInfo.getCertificateContent(), userLoginInfo.getUserUrn(),
                userLoginInfo.getUserAuthorityServer(), geniUserFactory);
    }

    ManualUserLoginInfo(@Nonnull UserLoginInfo userLoginInfo, GeniUserFactory geniUserFactory, AuthorityFinder authorityFinder) {
        super(userLoginInfo.getCertificateContent(), geniUserFactory, authorityFinder);
    }

    @Override
    public String getUserLoginTypeName() {
        return "Manual Info";
    }

    @Override
    public boolean equals(UserLoginInfo o) {
        if(!(o instanceof ManualUserLoginInfo))
            return false;

        return super.equalInfo(o);
    }
}
