Contrastive Representation Learning for Anomaly Detection on Time-series