<commit_before>/**
 * Copyright (C) <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package no.digipost.signature.client.portal;

import no.digipost.signature.client.core.OnBehalfOf;
import no.digipost.signature.client.core.SignatureType;
import no.digipost.signature.client.core.internal.IdentifierType;
import no.digipost.signature.client.core.internal.SignerCustomizations;

import java.util.Optional;

import static no.digipost.signature.client.core.OnBehalfOf.OTHER;
import static no.digipost.signature.client.core.internal.IdentifierType.EMAIL;
import static no.digipost.signature.client.core.internal.IdentifierType.EMAIL_AND_MOBILE_NUMBER;
import static no.digipost.signature.client.core.internal.IdentifierType.MOBILE_NUMBER;
import static no.digipost.signature.client.core.internal.IdentifierType.PERSONAL_IDENTIFICATION_NUMBER;
import static no.digipost.signature.client.core.internal.PersonalIdentificationNumbers.mask;

public class PortalSigner {

    private final IdentifierType identifierType;
    private final Optional<String> identifier;

    private Notifications notifications;
    private NotificationsUsingLookup notificationsUsingLookup;

    private int order = 0;
    private Optional<SignatureType> signatureType = Optional.empty();
    private Optional<OnBehalfOf> onBehalfOf = Optional.empty();

    private PortalSigner(IdentifierType identifierType, Notifications notifications) {
        this.identifier = Optional.empty();
        this.identifierType = identifierType;
        this.notifications = notifications;
    }

    private PortalSigner(String personalIdentificationNumber, Notifications notifications, NotificationsUsingLookup notificationsUsingLookup) {
        this.identifier = Optional.of(personalIdentificationNumber);
        this.identifierType = PERSONAL_IDENTIFICATION_NUMBER;
        this.notifications = notifications;
        this.notificationsUsingLookup = notificationsUsingLookup;
    }

    /**
     * @deprecated See {@link #identifiedByPersonalIdentificationNumber(String, Notifications)}
     */
    @Deprecated
    public static Builder builder(String personalIdentificationNumber, Notifications notifications) {
        return new Builder(personalIdentificationNumber, notifications, null);
    }

    /**
     * @deprecated See {@link #identifiedByPersonalIdentificationNumber(String, NotificationsUsingLookup)}
     */
    @Deprecated
    public static Builder builder(String personalIdentificationNumber, NotificationsUsingLookup notificationsUsingLookup) {
        return new Builder(personalIdentificationNumber, null, notificationsUsingLookup);
    }

    public static Builder identifiedByPersonalIdentificationNumber(String personalIdentificationNumber, Notifications notifications) {
        return new Builder(personalIdentificationNumber, notifications, null);
    }

    public static Builder identifiedByPersonalIdentificationNumber(String personalIdentificationNumber, NotificationsUsingLookup notificationsUsingLookup) {<commit_msg>Fjerner et par metoder som er `@Deprecated`<commit_after>/**
 * Copyright (C) <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package no.digipost.signature.client.portal;

import no.digipost.signature.client.core.OnBehalfOf;
import no.digipost.signature.client.core.SignatureType;
import no.digipost.signature.client.core.internal.IdentifierType;
import no.digipost.signature.client.core.internal.SignerCustomizations;

import java.util.Optional;

import static no.digipost.signature.client.core.OnBehalfOf.OTHER;
import static no.digipost.signature.client.core.internal.IdentifierType.EMAIL;
import static no.digipost.signature.client.core.internal.IdentifierType.EMAIL_AND_MOBILE_NUMBER;
import static no.digipost.signature.client.core.internal.IdentifierType.MOBILE_NUMBER;
import static no.digipost.signature.client.core.internal.IdentifierType.PERSONAL_IDENTIFICATION_NUMBER;
import static no.digipost.signature.client.core.internal.PersonalIdentificationNumbers.mask;

public class PortalSigner {

    private final IdentifierType identifierType;
    private final Optional<String> identifier;

    private Notifications notifications;
    private NotificationsUsingLookup notificationsUsingLookup;

    private int order = 0;
    private Optional<SignatureType> signatureType = Optional.empty();
    private Optional<OnBehalfOf> onBehalfOf = Optional.empty();

    private PortalSigner(IdentifierType identifierType, Notifications notifications) {
        this.identifier = Optional.empty();
        this.identifierType = identifierType;
        this.notifications = notifications;
    }

    private PortalSigner(String personalIdentificationNumber, Notifications notifications, NotificationsUsingLookup notificationsUsingLookup) {
        this.identifier = Optional.of(personalIdentificationNumber);
        this.identifierType = PERSONAL_IDENTIFICATION_NUMBER;
        this.notifications = notifications;
        this.notificationsUsingLookup = notificationsUsingLookup;
    }

    public static Builder identifiedByPersonalIdentificationNumber(String personalIdentificationNumber, Notifications notifications) {
        return new Builder(personalIdentificationNumber, notifications, null);
    }

    public static Builder identifiedByPersonalIdentificationNumber(String personalIdentificationNumber, NotificationsUsingLookup notificationsUsingLookup) {
{'fraction_non_alphanumeric': 0.07205104263927793, 'fraction_numerical': 0.001556178026766262, 'mean_word_length': 5.091943127962085, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3751161', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1550, 'n_words': 414}