export interface Subscription {
  id: string;
  userId: string;
  tenantId: string;
  plan: 'free' | 'basic' | 'pro' | 'enterprise';
  status: 'active' | 'cancelled' | 'expired' | 'trial';
  startDate: Date;
  endDate: Date;
  autoRenew: boolean;
  createdAt: Date;
  updatedAt: Date;
}

export class SubscriptionEntity {
  static create(data: Partial<Subscription>): Subscription {
    return {
      id: data.id || `sub-${Date.now()}`,
      userId: data.userId || '',
      tenantId: data.tenantId || '',
      plan: data.plan || 'free',
      status: data.status || 'trial',
      startDate: data.startDate || new Date(),
      endDate: data.endDate || new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
      autoRenew: data.autoRenew ?? false,
      createdAt: data.createdAt || new Date(),
      updatedAt: data.updatedAt || new Date()
    };
  }
}
