-- name: CreateTransfer :one
INSERT INTO wallet_transfer (
        amount,
        type,
        receiver_wallet_id,
        sender_wallet_id,
        cashier_id,
        verified,
        reference_number,
        status,
        payment_method
    )
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
RETURNING *;
-- name: GetAllTransfers :many
SELECT *
FROM wallet_transfer;
-- name: GetTransfersByWallet :many
SELECT *
FROM wallet_transfer
WHERE receiver_wallet_id = $1
    OR sender_wallet_id = $1;
-- name: GetTransferByID :one
SELECT *
FROM wallet_transfer
WHERE id = $1;
-- name: GetTransferByReference :one
SELECT *
FROM wallet_transfer
WHERE reference_number = $1;
-- name: UpdateTransferVerification :exec
UPDATE wallet_transfer
SET verified = $1,
    updated_at = CURRENT_TIMESTAMP
WHERE id = $2;

-- name: UpdateTransferStatus :exec
UPDATE wallet_transfer
SET status = $1,
    updated_at = CURRENT_TIMESTAMP
WHERE id = $2;