//
//  RaylinkProxy.h
//  raylink_sdk_flutter
//
//  Created by Sim Tsai on 2022/12/14.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol RaylinkProxyDelegate <NSObject>


@optional
- (void)sdnRouteChange:(NSString *)sdnId type:(int)type;

- (void)onProxyConnected:(NSString *)sdnId status:(int)status;

- (void)OnProxyDisconnected_cb:(NSString *)sdnId;

@end

typedef void(^RaylinkProxyConnectBlock)(int port);

@interface RaylinkProxy : NSObject

+ (instancetype)sharedManager;

@property (nonatomic, weak) id<RaylinkProxyDelegate> delegate;

- (void)initProxy:(NSString *)logPath rootSdnInfo:(NSData *)rootSdnInfo;

- (BOOL)createNewConnection:(NSString *)sdnId;

- (NSUInteger)createHttpService:(NSString *)sdnId;

- (void)closeConnection:(NSString *)sdnId;

- (void)closeHttpService:(NSString *)sdnId;

- (BOOL)addSdnId:(NSString *)sdnId allowPort:(NSUInteger)port;

- (NSString *)getSdnId;

- (BOOL)isSdnConnected;

@end

NS_ASSUME_NONNULL_END
