import { SemanticType } from '../Semantics.js';
/**
 * JSON Schema definition of the configuration options for AI/LLMs
 * to understand what parameters are available on this Semantic.
 */
export const AiSemanticsConfig = {
    [SemanticType.Address]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Calculated]: {
        type: 'object',
        description: 'Use Calculated when you need mathematical operations, aggregations, or complex business logic.',
        properties: {
            formula: {
                type: 'string',
                description: 'Formula to calculate the value (e.g., "price * quantity").',
            },
            dependencies: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of field keys this calculation depends on.',
            },
            recalculateOnUpdate: {
                type: 'boolean',
                default: true,
                description: 'Whether to automatically recalculate when source fields change.',
            },
            allowManualOverride: {
                type: 'boolean',
                default: false,
                description: 'Whether users can manually override the calculated value.',
            },
        },
    },
    [SemanticType.Categories]: {
        type: 'object',
        description: 'Controls allowed categories, hierarchy, and formatting for associations.',
        properties: {
            allowedCategories: {
                type: 'array',
                items: { type: 'string' },
                description: 'Pre-defined list of allowed categories.',
            },
            allowCustomCategories: {
                type: 'boolean',
                default: true,
                description: 'Whether users can create new categories not in the allowed list.',
            },
            allowHierarchy: {
                type: 'boolean',
                default: true,
                description: 'Whether categories can have sub-categories (parent-child relationship).',
            },
            maxDepth: { type: 'number', description: 'Maximum nesting depth for category hierarchies.' },
            caseSensitive: { type: 'boolean', default: false },
            allowUnicode: { type: 'boolean', default: false },
        },
    },
    [SemanticType.City]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.ClientIPAddress]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Country]: {
        type: 'object',
        properties: {
            format: {
                type: 'string',
                enum: ['ISO_3166_Alpha_2', 'ISO_3166_Alpha_3', 'Name'],
                default: 'ISO_3166_Alpha_2',
                description: 'Format to store the country in. Alpha_2 is standard 2-letter code (e.g. US), ' +
                    'Alpha_3 is 3-letter (e.g. USA), Name is full name.',
            },
            allowedCountries: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of allowed countries in the specified format. If empty, all are allowed.',
            },
            disallowedCountries: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of explicitly forbidden countries.',
            },
        },
    },
    [SemanticType.CreatedTimestamp]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Currency]: {
        type: 'object',
        description: 'Controls monetary value storage, validation, currency handling, and precision.',
        properties: {
            storageFormat: {
                type: 'string',
                enum: ['decimal', 'integer_cents', 'complex_object'],
                default: 'decimal',
                description: 'Format to store currency. decimal relies on decimal floating points, ' +
                    'integer_cents stores values as an integer of cents, and ' +
                    'complex_object stores both amount and currency code.',
            },
            defaultCurrency: {
                type: 'string',
                default: 'USD',
                description: 'Default ISO 4217 currency code if none is provided.',
            },
            allowedCurrencies: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of allowed ISO 4217 currency codes. If empty, all are allowed.',
            },
            decimalPlaces: { type: 'number', default: 2, description: 'Number of decimal places to enforce/round to.' },
            allowNegative: { type: 'boolean', default: false, description: 'Whether to allow negative currency values.' },
            validateCurrencyCode: {
                type: 'boolean',
                default: true,
                description: 'Whether to validate the currency code against standard ISO codes.',
            },
        },
    },
    [SemanticType.DeletedFlag]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.DeletedTimestamp]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Derived]: {
        type: 'object',
        description: 'Use Derived when you need to combine, format, or transform existing field values',
        properties: {
            sourceFields: {
                type: 'array',
                items: { type: 'string' },
                description: 'Array of field keys that this derived field depends on.',
            },
            transformation: {
                type: 'string',
                description: 'Name of a transformation function to apply to the source fields.',
            },
            recalculateOnUpdate: {
                type: 'boolean',
                default: true,
                description: 'Whether to automatically recalculate when source fields change.',
            },
            allowManualOverride: {
                type: 'boolean',
                default: false,
                description: 'Whether users can manually override the derived value.',
            },
        },
    },
    [SemanticType.Description]: {
        type: 'object',
        description: "The description field doesn't have any configuration options.",
        properties: {},
    },
    [SemanticType.Email]: {
        type: 'object',
        properties: {
            allowedDomains: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of allowed domains (e.g. example.com). If empty, all valid domains are permitted.',
            },
            disallowedDomains: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of disallowed domains (e.g. example.com).',
            },
            requireVerification: {
                type: 'boolean',
                default: true,
                description: 'Whether the email address requires a verification confirm loop.',
            },
            allowSubaddressing: {
                type: 'boolean',
                default: true,
                description: 'Whether to allow plus addressing e.g. user+tag@example.com',
            },
            allowInternational: {
                type: 'boolean',
                default: true,
                description: 'Whether to allow internationalized domain names and characters in the local part.',
            },
        },
    },
    [SemanticType.FileURL]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.GeospatialCoordinates]: {
        type: 'object',
        properties: {
            format: {
                type: 'string',
                enum: ['lat,lon', 'lon,lat', 'postgis', 'degree', 'wkt', 'geojson'],
                default: 'lat,lon',
            },
            spatialReferenceSystem: {
                type: 'string',
                enum: ['EPSG:4326', 'EPSG:3857', 'EPSG:4269', 'EPSG:4267'],
                default: 'EPSG:4326',
                description: 'The spatial reference system (SRS) for the coordinates. Defaults to WGS84 (EPSG:4326).',
            },
            defaultDistanceUnit: {
                type: 'string',
                enum: ['meters', 'kilometers', 'miles', 'feet', 'yards', 'nautical_miles'],
                default: 'meters',
                description: 'The default distance unit for spatial queries.',
            },
            enableSpatialIndexing: { type: 'boolean', default: true },
            enableValidation: { type: 'boolean', default: true },
            validationBounds: {
                type: 'object',
                properties: {
                    minLatitude: { type: 'number' },
                    maxLatitude: { type: 'number' },
                    minLongitude: { type: 'number' },
                    maxLongitude: { type: 'number' },
                },
                description: 'Custom validation rules for coordinate bounds in decimal degrees.',
            },
            enablePostGISIntegration: { type: 'boolean', default: true },
            postGISGeometryType: {
                type: 'string',
                enum: ['POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON'],
                default: 'POINT',
                description: 'The PostGIS geometry type to use for storage. Defines the shape of the data and the types of queries.',
            },
            enableDistanceQueries: { type: 'boolean', default: true },
            maxQueryDistance: { type: 'number', default: 100000 },
            enableBoundingBoxQueries: { type: 'boolean', default: true },
            enablePolygonQueries: { type: 'boolean', default: false },
            apiEndpointPrefix: { type: 'string', default: '/nearby' },
            includeElevation: { type: 'boolean', default: false },
            coordinatePrecision: { type: 'number', default: 6 },
            enableReverseGeocoding: { type: 'boolean', default: false },
        },
    },
    [SemanticType.HTML]: {
        type: 'object',
        properties: {
            allowedTags: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of allowed HTML tags. Tags not in this list will be stripped.',
            },
            sanitizeLevel: {
                type: 'string',
                enum: ['strict', 'moderate', 'none'],
                default: 'strict',
                description: 'Sanitization level. Strict removes almost all styling and scripts. ' +
                    'Moderate allows some unsafe constructs like scripts. None bypasses sanitization.',
            },
            allowImages: { type: 'boolean', default: true },
            allowLinks: { type: 'boolean', default: true },
            allowTables: { type: 'boolean', default: true },
            allowForms: { type: 'boolean', default: false },
            allowScripts: { type: 'boolean', default: false },
            allowIframes: { type: 'boolean', default: false },
            allowEmbedded: { type: 'boolean', default: false },
            allowStyles: { type: 'boolean', default: false },
            allowDataAttributes: { type: 'boolean', default: false },
        },
    },
    [SemanticType.ImageURL]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Markdown]: {
        type: 'object',
        properties: {
            allowedTags: { type: 'array', items: { type: 'string' }, description: 'Allowed HTML tags within the Markdown.' },
            sanitizeLevel: {
                type: 'string',
                enum: ['strict', 'moderate', 'none'],
                default: 'strict',
                description: 'Sanitization level for HTML within Markdown. Strict removes all. ' +
                    'Moderate allows basic formatting tags. None bypasses sanitization.',
            },
            allowImages: { type: 'boolean', default: true },
            allowLinks: { type: 'boolean', default: true },
            allowTables: { type: 'boolean', default: true },
            allowHtml: { type: 'boolean', default: false },
            allowFootnotes: { type: 'boolean', default: false },
            allowTaskLists: { type: 'boolean', default: false },
            allowStrikethrough: { type: 'boolean', default: true },
            allowMath: { type: 'boolean', default: false },
        },
    },
    [SemanticType.Name]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Password]: {
        type: 'object',
        properties: {
            requireSpecialChars: { type: 'boolean', default: false },
            requireNumbers: { type: 'boolean', default: false },
            requireUppercase: { type: 'boolean', default: false },
            requireLowercase: { type: 'boolean', default: false },
            encryptionAlgorithm: {
                type: 'string',
                enum: ['bcrypt', 'argon2', 'scrypt'],
                default: 'bcrypt',
                description: 'The algorithm used to hash the password before storage.',
            },
            saltRounds: {
                type: 'number',
                default: 12,
                description: 'Work factor for hashing algorithms like bcrypt or argon2.',
            },
            maxAge: { type: 'number', description: 'Maximum age in days before the password expires.' },
            preventReuse: { type: 'boolean', default: false, description: 'Whether to prevent reuse of previous passwords.' },
            preventReuseCount: {
                type: 'number',
                default: 5,
                description: 'Number of previous passwords to remember and prevent reuse of.',
            },
            customPattern: { type: 'string', description: 'Custom regex pattern for password validation.' },
            customErrorMessage: { type: 'string' },
            allowCommonPasswords: {
                type: 'boolean',
                default: false,
                description: 'Whether to check against dictionaries of common/compromised passwords.',
            },
        },
    },
    [SemanticType.Phone]: {
        type: 'object',
        properties: {
            allowedCountries: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of allowed country codes (ISO 3166-1 alpha-2 format).',
            },
            requireCountryCode: {
                type: 'boolean',
                default: true,
                description: 'Whether the phone number must include a country code.',
            },
            format: {
                type: 'string',
                enum: ['national', 'international', 'custom'],
                default: 'international',
                description: 'Format for phone validation and display. national omits country code, ' +
                    'international uses E.164 (+1...), custom uses customFormat pattern.',
            },
            customFormat: {
                type: 'string',
                description: 'Custom pattern like "(###) ###-####"; only used when format is custom.',
            },
            allowExtension: { type: 'boolean', default: false },
            requireVerification: { type: 'boolean', default: false },
            verificationMethod: { type: 'string', enum: ['sms', 'call'], default: 'sms' },
        },
    },
    [SemanticType.PostalCode]: {
        type: 'object',
        properties: {
            validate: { type: 'boolean', default: false, description: 'Whether to validate the postal code format.' },
            allowedPostalCodes: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of exactly allowed postal codes.',
            },
            disallowedPostalCodes: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of explicitly forbidden postal codes.',
            },
        },
    },
    [SemanticType.PublicUniqueName]: {
        type: 'object',
        properties: {
            sourceField: { type: 'string', description: 'The field to derive the public unique name from.' },
            separator: {
                type: 'string',
                default: '-',
                description: 'Character used to replace spaces or combine multiple words (e.g. "-" for slugs).',
            },
            caseSensitive: { type: 'boolean', default: false },
            allowUnicode: { type: 'boolean', default: false, description: 'Whether to allow non-ASCII characters.' },
            allowDuplicates: {
                type: 'boolean',
                default: false,
                description: 'Whether to append random suffix if the name is already taken. Defaults to failing uniqueness.',
            },
            fallbackField: { type: 'string', description: 'A field to use if the source field is empty.' },
        },
    },
    [SemanticType.Region]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.ResourceOwnerIdentifier]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.SKU]: {
        type: 'object',
        properties: {
            validationMode: {
                type: 'string',
                enum: ['strict', 'lenient', 'custom'],
                default: 'strict',
                description: 'Validation strictness. strict enforces alphanumeric + hyphens/underscores. ' +
                    'lenient allows more special chars. custom uses customPattern.',
            },
            customPattern: { type: 'string', description: 'Regex pattern applied when validationMode is custom.' },
            caseMode: { type: 'string', enum: ['uppercase', 'lowercase', 'preserve'], default: 'uppercase' },
            prefix: { type: 'string', description: 'Required prefix for all SKUs.' },
            enforceUniqueness: { type: 'boolean', default: true },
            autoGenerate: { type: 'boolean', default: false, description: 'Whether to automatically generate the SKU.' },
            autoGenerateSource: { type: 'string', description: 'Field to derive the SKU from, if autoGenerate is true.' },
            validateReservedWords: { type: 'boolean', default: true },
            reservedValues: {
                type: 'array',
                items: { type: 'string' },
                description: 'Specific SKUs that are not permitted to be used.',
            },
        },
    },
    [SemanticType.Status]: {
        type: 'object',
        properties: {
            allowedStates: {
                type: 'array',
                items: { type: 'string' },
                description: 'Pre-defined list of valid states (e.g., draft, published, archived).',
            },
            defaultState: { type: 'string', description: 'The initial state assigned when an entity is created.' },
            transitions: {
                type: 'object',
                additionalProperties: { type: 'array', items: { type: 'string' } },
                description: 'Map representing allowed state transitions. ' +
                    'Key is current state and value is array of valid next states.',
            },
            stateBehaviors: {
                type: 'object',
                additionalProperties: {
                    type: 'object',
                    properties: {
                        isPublic: { type: 'boolean', default: true },
                        isEditable: { type: 'boolean', default: true },
                        isDeletable: { type: 'boolean', default: false },
                        requiresApproval: { type: 'boolean', default: false },
                        displayName: { type: 'string' },
                        description: { type: 'string' },
                        color: { type: 'string' },
                        icon: { type: 'string' },
                    },
                },
            },
            workflow: {
                type: 'object',
                properties: {
                    requiresApproval: { type: 'boolean', default: false },
                    approvalRoles: { type: 'array', items: { type: 'string' } },
                    sendNotifications: { type: 'boolean', default: false },
                    notificationChannels: {
                        type: 'array',
                        items: {
                            type: 'string',
                            enum: ['email', 'sms', 'push', 'webhook'],
                        },
                    },
                    logHistory: { type: 'boolean', default: true },
                    allowBulkChanges: { type: 'boolean', default: false },
                },
            },
            autoTransitions: {
                type: 'array',
                items: {
                    type: 'object',
                    properties: {
                        from: { type: 'string' },
                        to: { type: 'string' },
                        condition: { type: 'string' },
                        requiresApproval: { type: 'boolean', default: false },
                    },
                    required: ['from', 'to', 'condition'],
                },
            },
        },
    },
    [SemanticType.StreetAddress]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.StreetAddressSupplemental]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Summary]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Tags]: {
        type: 'object',
        properties: {
            allowedTags: { type: 'array', items: { type: 'string' } },
            allowCustomTags: { type: 'boolean', default: true },
            caseSensitive: { type: 'boolean', default: false },
            allowUnicode: { type: 'boolean', default: false },
        },
    },
    [SemanticType.Title]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.UpdatedTimestamp]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.URL]: {
        type: 'object',
        properties: {
            requireHttps: { type: 'boolean', default: false },
            allowQueryParams: { type: 'boolean', default: true },
            allowFragments: { type: 'boolean', default: true },
            allowInternational: { type: 'boolean', default: true },
            allowIP: { type: 'boolean', default: true },
            allowPort: { type: 'boolean', default: true },
            allowAuthentication: { type: 'boolean', default: false },
        },
    },
    [SemanticType.User]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Username]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.UserRole]: {
        type: 'object',
        properties: {},
    },
    [SemanticType.Version]: {
        type: 'object',
        properties: {},
    },
};
//# sourceMappingURL=Semantics.js.map