//
//  BackendServers.h
//  Mingle
//
//  Created by Nookaraju Maddila on 12/8/16.
//  Copyright © 2016 Infor Global Solutions Inc, Alpharetta, USA. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BackendServer.h"

@interface BackendServers : NSObject

// for MDM servers list
-(instancetype)initMDMServersWithArray:(NSArray *)backendServersArray;
-(void)updateWithMDMservers:(BackendServers *)backendServers;
// when connecting for the first time
+(BackendServers *)createServersList;

// information about collection
-(NSUInteger)count;
-(BackendServer *)serverAtIndex:(NSUInteger)index;
-(NSUInteger)indexOfServer:(BackendServer *)server;

// managing collection
-(void)addServer:(BackendServer *)server;
-(void)setServer:(BackendServer *)server atIndex:(NSUInteger)index;
-(void)moveServerFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex;
-(void)repalceServer:(BackendServer *)server atIndex:(NSUInteger) index;
-(void)removeServerAtIndex:(NSUInteger)index;
//-(void)sortWithOrder:(BackendServerSorting)sortOrder;
-(void)removeServers;
-(void)removeServer:(BackendServer *)server;
//-(NSString *)fileRepresentation;

+(BackendServer *)parseBackendServerFromString:(NSString *)serverComponentsString;
+(BackendServer *)parseSharePointBackendServerFromString:(NSString *)serverComponentsString;

-(BackendServer *)server:(BackendServer *)backendServer;

-(void) setDefaultServer:(BackendServer *)server;
-(BOOL)saveServerConfiguration:(NSDictionary *)dictServerInfo;
-(void) updateServerName:(BackendServer *) server;
-(BackendServer *) getDefaultServer;
-(void) updateDefaultServerInList:(BackendServer *) defaultServer;

-(BOOL)addOldServerConfiguration:(NSDictionary *)dictServerInfo;
@end
