//
//  WZip.h
//  Warp
//
//  Created by Lukas Foldyna on 3.11.08.
//  Copyright 2008 ARaT. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef NS_ENUM(NSInteger, WZipAction) {
	WZipActionCompres = 0,
	WZipActionDecompres,
} ;

typedef NS_ENUM(NSInteger, WZipCompressionLevel) {
    WZipCompressionLevelNo = 0,
    WZipCompressionLevelBestSeed = 1,
    WZipCompressionLevelBestCompression = 9,
    WZipCompressionLevelDefault = (-1),
} ;


@protocol WZipDelegate;

/*
 * Vytvori nebo rozbali archiv
 */
@interface WZip : NSObject

@property (nonatomic, weak)   id<WZipDelegate> delegate;
@property (nonatomic, strong) NSString *password;

@property (nonatomic, strong) NSString *basePath;
@property (nonatomic, strong, readonly) NSArray *resources;
@property (nonatomic, strong, readonly) NSString *destination;
@property (nonatomic, assign, readonly) WZipAction action;

- (instancetype) initWithDelegate:(id<WZipDelegate>)delegate;

- (void) compressPath:(NSString *)resourcePath to:(NSString *)destinationPath;
- (void) compressPath:(NSString *)resourcePath to:(NSString *)destinationPath level:(WZipCompressionLevel)level;
- (void) compressResources:(NSArray *)resources to:(NSString *)destinationPath level:(WZipCompressionLevel)level;

- (void) decompress:(NSString *)resourcePath to:(NSString *)destinationPath;

- (void) cancel;

@end


@protocol WZipDelegate <NSObject>

@required
- (void) zip:(WZip *)zip discovered:(NSUInteger)numOfFiles;
- (void) zip:(WZip *)zip didCreateFolderAtPath:(NSString *)path atIndex:(NSUInteger)index;
- (void) zip:(WZip *)zip didDecompressFileAtPath:(NSString *)path atIndex:(NSUInteger)index;

- (void) zip:(WZip *)zip didCompressFolderAtPath:(NSString *)path;
- (void) zip:(WZip *)zip didCompressFileAtPath:(NSString *)path atIndex:(NSUInteger)index;

- (void) didZipFinish:(WZip *)zip;
- (void) didZipStop:(WZip *)zip error:(NSError *)error;

@end


extern NSString *const WZipDomain;
