Quantum model for rf-SQUID-based metamaterials enabling three-wave mixing and four-wave mixing traveling-wave parametric amplification