import { Empty } from "../config/type";
import { MySql } from "../helper/mysql";

export default class UserPaymentRepository {
  async index(param?: Record<string, any> | Empty): Promise<Record<string, any>> {
    const query = `
      SELECT * FROM payment
      WHERE active = ? 
      ORDER BY name ASC
    `;
    const values = [true];

    const result = await MySql.query(query, values);

    const data = {
      data: result as any,
    };

    return data;
  }
}

// export default class UserPaymentRepository {
//   async index(
//     param?: Record<string, any> | Empty
//   ): Promise<Record<string, any>> {
//     const result = await prisma.payment.findMany({
//       where: { active: true },
//       orderBy: {
//         name: "asc",
//       },
//     });

//     const data = {
//       data: result as any,
//     };

//     return data;
//   }
// }
