/**
 * VCServicesBrowser.h: Vacuum
 * Created by Jiří Urbášek on 9/29/12.
 *
 * Copyright (c) 2012, Arat. All rights reserved.
 *
 * This source code can be used only for purposes specified
 * by the given license contract signed by the rightful deputy of Arat.
 * This source code can be used only by the owner of the license.
 *
 * Any disputes arising in respect of this agreement (license) shall be brought
 * before the Municipal Court of Prague.
 */

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


@protocol VCServicesBrowserDelegate;

@interface VCServicesBrowser : NSObject

@property (nonatomic, assign) int port;
@property (nonatomic, readonly) BOOL isAdvertising;

@property (nonatomic, strong) NSString *deviceID;
@property (nonatomic, strong) NSString *deviceName;
@property (nonatomic, strong) NSString *deviceModel;
@property (nonatomic, strong) NSString *deviceApplicationType;
@property (nonatomic, strong) NSString *deviceNotificationToken;

@property (nonatomic, weak) id<VCServicesBrowserDelegate> delegate;
@property (strong, readonly) NSArray<VCService *> *services;

@property (nonatomic, strong) DNSSDService *advertisedService;

+ (VCServicesBrowser *)sharedBrowser;
- (instancetype)initWithDelegate:(id<VCServicesBrowserDelegate>)delegate;

/** Starts browsing for available services */
- (void)startBrowsing;

- (void)stopBrowsing;

/** Advertises it's service to public */
- (void)startAdvertising;

- (void)startFakeAdvertising;

- (void)stopAdvertising;

@end


@protocol VCServicesBrowserDelegate <NSObject>

@optional
- (void)browserDidStartBrowsing:(VCServicesBrowser *)browser;
- (void)browserDidFinishBrowsing:(VCServicesBrowser *)browser;
- (void)browser:(VCServicesBrowser *)browser didAddService:(VCService *)service;
- (void)browser:(VCServicesBrowser *)browser didRemoveService:(VCService *)service;
- (void)browser:(VCServicesBrowser *)browser didFailWithError:(NSError *)error;

@end
