001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2026 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.model.json.appgallery.portal;
011
012import ca.cdr.api.model.json.AbstractModelJson;
013import org.apache.commons.lang3.builder.ToStringBuilder;
014
015public class AGClientSecretJson extends AbstractModelJson {
016
017        private static final String SECRET_MASK = "***";
018
019        /**
020         * Value of {@link #warning} when a hook on
021         * {@link ca.cdr.api.fhir.interceptor.CdrPointcut#AG_OAUTH2_CLIENT_SECRET_REGENERATED} threw.
022         */
023        public static final String WARNING_INTERCEPTOR_NOTIFICATION_FAILED = "INTERCEPTOR_NOTIFICATION_FAILED";
024
025        public String clientId;
026
027        public String secret;
028
029        /**
030         * A non-fatal problem that occurred alongside a successful secret generation, or {@literal null} when there was
031         * none. The {@code secret} above is valid regardless. A fixed code -
032         * {@link #WARNING_INTERCEPTOR_NOTIFICATION_FAILED} is the only one set today.
033         */
034        public String warning;
035
036        /** Masks secret; JSON serialization still writes the real value. */
037        @Override
038        public String toString() {
039                return new ToStringBuilder(this)
040                                .append("clientId", clientId)
041                                .append("secret", secret == null ? null : SECRET_MASK)
042                                .append("warning", warning)
043                                .toString();
044        }
045}