export function rowToPackage(row) {
  if (!row) return null;
  return {
    id: row.id,
    name: row.name,
    description: row.description,
    rtpMinute: row.rtpMinute,
    rtpDay: row.rtpDay,
    tokenLimitMonthly: row.tokenLimitMonthly,
    creditLimit: row.creditLimit,
    creditToTokenRatio: row.creditToTokenRatio,
    maxConcurrent: row.maxConcurrent,
    durationDays: row.durationDays,
    price: row.price,
    isActive: row.isActive === 1 || row.isActive === true,
    createdAt: row.createdAt,
    updatedAt: row.updatedAt,
  };
}

export function rowToUserPackage(row) {
  if (!row) return null;
  return {
    id: row.id,
    userId: row.userId,
    packageId: row.packageId,
    rtpMinuteOverride: row.rtpMinuteOverride,
    rtpDayOverride: row.rtpDayOverride,
    tokenLimitMonthlyOverride: row.tokenLimitMonthlyOverride,
    creditLimitOverride: row.creditLimitOverride,
    maxConcurrentOverride: row.maxConcurrentOverride,
    assignedAt: row.assignedAt,
    expiresAt: row.expiresAt,
  };
}
