package com.aip.gateway.api.aip.utils;

import com.aip.gateway.api.aip.model.AipLabel;
import com.aip.gateway.api.aip.model.AipTemplate;
import com.microsoft.informationprotection.Label;
import com.microsoft.informationprotection.internal.protection.TemplateDescriptor;

import java.util.ArrayList;

public class Utilities {

    public static AipLabel labelToAip(Label label) {
        if (label == null) return null;

        return AipLabel.builder()
                .id(label.getId())
                .name(label.getName())
                .sensitivity(label.getSensitivity())
                .description(label.getDescription())
                .isActive(label.isActive())
                .actionSource(label.getActionsource().ordinal())
                .children(new ArrayList<>())
                .build();
    }
    public static AipTemplate templateToAip(TemplateDescriptor template) {
        if (template == null) return null;
        return AipTemplate.builder()
                .id(template.getId())
                .name(template.getName())
                .description(template.getDescription())
                .build();
    }
//    public static AipProtectionDescriptor protectionDescriptorToAip(ProtectionDescriptor protectionDescriptor) {
//        if (protectionDescriptor == null) return null;
//        return AipProtectionDescriptor.builder()
//                .owner(protectionDescriptor.getOwner())
//                .build();
//    }
}
