package com.cameleer.server.core.outbound;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
@JsonSubTypes({
    @JsonSubTypes.Type(OutboundAuth.None.class),
    @JsonSubTypes.Type(OutboundAuth.Bearer.class),
    @JsonSubTypes.Type(OutboundAuth.Basic.class),
})
public sealed interface OutboundAuth permits OutboundAuth.None, OutboundAuth.Bearer, OutboundAuth.Basic {
    OutboundAuthKind kind();

    record None() implements OutboundAuth {
        public OutboundAuthKind kind() { return OutboundAuthKind.NONE; }
    }
    record Bearer(String tokenCiphertext) implements OutboundAuth {
        public OutboundAuthKind kind() { return OutboundAuthKind.BEARER; }
    }
    record Basic(String username, String passwordCiphertext) implements OutboundAuth {
        public OutboundAuthKind kind() { return OutboundAuthKind.BASIC; }
    }
}
