/**
 * Default Sales Return ID Generator Port Implementation
 */

import type { SalesReturnIdGeneratorPort } from '../application/sales-return-id-generator.port';

export class DefaultSalesReturnIdGeneratorPort
  implements SalesReturnIdGeneratorPort
{
  async generateReturnId(): Promise<string> {
    // Generate UUID-like ID
    return `return_${Date.now()}_${Math.random().toString(36).substring(7)}`;
  }

  async generateReturnNumber(year: number): Promise<string> {
    // Generate R/YYYY/XXXX format
    // TODO: Get actual sequence from database
    const sequence = Math.floor(Math.random() * 10000)
      .toString()
      .padStart(4, '0');
    return `R/${year}/${sequence}`;
  }
}
