package com.ecep.contract.msg;

import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import lombok.Data;

@Data
public class SimpleMessage {

    private String messageId = UUID.randomUUID().toString();

    private String service;
    private String method;
    private Object data;
    private List<String> parameterTypes;
    private List<Object> arguments;

    public void setArguments(Object... arguments) {
        this.parameterTypes = Arrays.stream(arguments)
                .map(arg -> arg != null ? arg.getClass().getName() : null)
                .collect(Collectors.toList());
        this.arguments = Arrays.asList(arguments);
    }

}
