/* EOAccessAdditions.h created by lindberg on Mon 20-Dec-1999 */

#import <EOAccess/EOModel.h>
#import <EOAccess/EOEntity.h>
#import <EOAccess/EOAttribute.h>
#import <EOAccess/EORelationship.h>
#import <EOControl/EOFetchSpecification.h>
#import "SystemType.h"

/* EOAccess extension methods for use by templates */

@interface EOModel (EOAccessAdditions)

// Tries to find the framework name. First looks to see if a value for
// "EOGeneratorFrameworkName" exists in the model's -userInfo dictionary, and if
// not, looks at the model's -path to find the framework the .eomodeld is in.
// Both PB.project files and path components ending in ".framework" are looked
// for, so it should work for .eomodels insided installed frameworks or in a
// development tree. If the framework name could not be found, returns nil.
- (NSString *)frameworkName;

// Uses isLike: to do the comparisons
- (NSArray *)entityNamesMatchingWildcard:(NSString *)wildcard;

@end

@interface EOEntity (EOAccessAdditions)

- (BOOL)hasParentEntity;
- (NSString *)frameworkName;

- (NSString *)objcImportString;
- (NSString *)objcImportStringInRelationToEntity:(EOEntity *)sourceEntity;
- (NSString *)parentObjCImportString;

//uniqued array of relationships' -objcImportString
- (NSArray *)referencedObjCImportStrings;
- (NSArray *)arrayWithParentObjCImportStringIfNeeded;

#ifdef EOF2_ONLY
// Define for use by EOF2 systems
- (NSString *)classNameWithoutPackage;
- (NSArray *)fetchSpecificationNames;
- (EOFetchSpecification *)fetchSpecificationNamed:(NSString *)name;
#endif

// Getting the Java package as a string
- (NSString *)classPackageName;

#ifndef EOF2_ONLY
- (NSString *)clientClassPackageName;
- (NSString *)javaParentClientClassName;

// JavaClient methods... reimplementation of ones in EOJavaClientExtensions.EOMBundle
- (NSArray *)clientClassAttributes;
- (NSArray *)clientClassToOneRelationships;
- (NSArray *)clientClassToManyRelationships;
- (NSArray *)clientClassScalarAttributes;
- (NSArray *)clientClassNonScalarAttributes;
#endif

- (NSArray *)fetchSpecifications;
- (NSArray *)beautifiedFetchSpecificationDictionaries;
- (NSArray *)javaBeautifiedFetchSpecificationDictionaries;

@end

#ifndef EOF2_ONLY
// <EOJavaClient/EOAccessAdditions.h> isn't always there (the ObjC framework
// does not come with WO 4.5.1 on OS X or with WO 5), so just declare the
// methods here.  Except with WO 4.0, the methods are actually implemented
// in the EOAccess framework, so this is OK.
@interface EOEntity (JavaClientExtensions)
- (NSString *)clientClassName;
- (NSString *)clientClassNameWithoutPackage;
- (NSString *)referenceClientClassName;
- (NSArray *)clientClassProperties;
- (NSArray *)clientClassPropertyAttributeNames;
- (NSArray *)clientClassPropertyToOneRelationshipNames;
- (NSArray *)clientClassPropertyToManyRelationshipNames;
@end
#endif

@interface EORelationship (EOAccessAdditions)

// If the destination entity is in an external framework, returns
// <Framework/ClassName.h>, otherwise returns "ClassName.h".
- (NSString *)objcImportString;

@end

@interface EOAttribute (EOAccessAdditions)

- (NSString *)javaValueTypeClassName;
- (NSString *)javaScalarValueTypeClassName;

@end

@interface EOFetchSpecification (EOAccessAdditions)

- (NSArray *)bindingParametersIsJava:(BOOL)isJava;
- (NSArray *)bindingParameters;
- (NSArray *)javaBindingParameters;

@end

@interface NSString (ModelStringManipulations)

- (NSString *)uppercaseUnderbarString;
- (NSString *)lowercaseNonUnderbarString;

@end

@interface EOGeneratorAttributePoser : EOAttribute
@end