export interface Trial {
  id: string;
  userId: string;
  planType: 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE';
  startDate: Date;
  endDate: Date;
  status: 'active' | 'expired' | 'converted' | 'cancelled';
  features: string[];
  usageLimit: {
    products: number;
    orders: number;
    apiCalls: number;
  };
  usageUsed: {
    products: number;
    orders: number;
    apiCalls: number;
  };
  createdAt: Date;
  updatedAt: Date;
}

export class TrialEntity {
  static create(data: Partial<Trial>): Trial {
    const now = new Date();
    const endDate = new Date(now);
    endDate.setDate(endDate.getDate() + 14);

    return {
      id: data.id || `trial-${Date.now()}`,
      userId: data.userId || '',
      planType: data.planType || 'STARTER',
      startDate: data.startDate || now,
      endDate: data.endDate || endDate,
      status: data.status || 'active',
      features: data.features || ['basic_analytics', 'product_management', 'order_management'],
      usageLimit: data.usageLimit || { products: 100, orders: 500, apiCalls: 10000 },
      usageUsed: data.usageUsed || { products: 0, orders: 0, apiCalls: 0 },
      createdAt: data.createdAt || now,
      updatedAt: data.updatedAt || now
    };
  }
}
