/*
 * Copyright (c) 2015-2020, www.dibo.ltd (service@dibo.ltd).
 * <p>
 * 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
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * 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 com.diboot.core.data.annotation;

import com.diboot.core.data.encrypt.DoNothingEncryptStrategy;
import com.diboot.core.data.encrypt.IEncryptStrategy;
import com.diboot.core.data.mask.DoNothingMaskStrategy;
import com.diboot.core.data.mask.IMaskStrategy;
import com.diboot.core.data.mask.SensitiveInfoSerialize;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.lang.annotation.*;

/**
 * 保护字段
 * <p>
 * 对字段进行 加密存储，脱敏展示
 *
 * @author wind
 * @version v2.3.1
 * @date 2021/08/19
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@JacksonAnnotationsInside
@JsonSerialize(using = SensitiveInfoSerialize.class)
@Inherited
@Documented
public @interface ProtectField {
    /**
     * 加密策略
     */
    Class<? extends IEncryptStrategy> encryptor() default DoNothingEncryptStrategy.class;

    /**
     * 脱敏策略
     */
    Class<? extends IMaskStrategy> mask() default DoNothingMaskStrategy.class;
}
