/**
 * Version management for the easy-email library
 */

export const VERSION = {
  major: 4,
  minor: 0,
  patch: 2,
  toString(): string {
    return `${this.major}.${this.minor}.${this.patch}`;
  },
  isCompatible(otherVersion: string): boolean {
    const [major] = otherVersion.split('.').map(Number);
    return major === this.major;
  }
} as const;

export const LIBRARY_INFO = {
  name: '@454creative/easy-email',
  version: VERSION.toString(),
  description: 'A framework-agnostic email service library for Node.js with observability and monitoring',
  author: 'Will Chu <wchu@454creative.com>',
  license: 'ISC',
  repository: 'https://bitbucket.org/454creative/easy-email',
  homepage: 'https://bitbucket.org/454creative/easy-email#readme',
  bugs: 'https://bitbucket.org/454creative/easy-email/issues',
  engines: {
    node: '>=14.0.0'
  }
} as const;

/**
 * Get library information
 */
export function getLibraryInfo() {
  return {
    ...LIBRARY_INFO,
    version: VERSION.toString(),
    fullVersion: VERSION.toString()
  };
}

/**
 * Check if the current version is compatible with a given version
 */
export function isVersionCompatible(version: string): boolean {
  return VERSION.isCompatible(version);
} 