//
//  DirectedFindServicesRequest.m
//  LostClient
//
//  Created by Webster Ross III on 4/2/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "DirectedFindServicesRequest.h"
#import "Constants.h"


@implementation DirectedFindServicesRequest

@synthesize searchRadius, maxResults, serviceURN, location;

- (id) initWithLocation:(CLLocation *)theLocation service:(NSString *)urn searchRadius:(double)radius maxResults:(int)max {
	self.location = theLocation;
	self.searchRadius = radius;
	self.maxResults = max;
	self.serviceURN = urn;
	return self;	
}

+ (id) requestWithLocation:(CLLocation *)theLocation service:(NSString *)urn searchRadius:(double)radius maxResults:(int)max {
	return [[[DirectedFindServicesRequest alloc] initWithLocation:theLocation service:urn searchRadius:radius maxResults:max]autorelease];	
}

- (NSString *)buildXML {
	
	if(searchRadius == LOST_VALUE_UNLIMITED && maxResults == LOST_VALUE_UNLIMITED) {
		return @"Regular Query";
	}
	
	if(searchRadius == LOST_VALUE_UNLIMITED && maxResults != LOST_VALUE_UNLIMITED) {
		return @"N Query";
	}
	
	if(searchRadius != LOST_VALUE_UNLIMITED && maxResults == LOST_VALUE_UNLIMITED) {
		return @"X Query";
	}
	
	return @"XN Query";
}

- (void)dealloc {
	[serviceURN release];
	[location release];
    [super dealloc];
}

@end
