// Un pago de pasaje: en efectivo, con tarjeta o con billetera del celular.
#ifndef PAYMENT_H
#define PAYMENT_H

typedef enum { PAY_CASH, PAY_CARD, PAY_WALLET } PaymentKind;

typedef struct {
    PaymentKind kind;
    union {
        double cash;   // PAY_CASH: soles recibidos
        int card_end;  // PAY_CARD: últimos cuatro dígitos
        char *phone;   // PAY_WALLET: número del celular; lo posee el Payment
    } as;
} Payment;

Payment payment_cash(double soles);
Payment payment_card(int card_end);

// Guarda una copia de phone. Si no hay memoria, devuelve un pago en efectivo de 0 soles.
Payment payment_wallet(const char *phone);

void payment_print(const Payment *p);

// Libera lo que el pago posee y lo deja como un pago en efectivo de 0 soles.
void payment_free(Payment *p);

#endif
