package cn.reghao.devops.web.mgr.machine.model.po;

import cn.reghao.jutil.jdk.machine.data.detail.NetworkDetail;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author reghao
 * @date 2021-10-15 15:49:43
 */
@NoArgsConstructor
@Embeddable
@Data
public class NetworkInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    @NotNull
    private String iface;
    @NotNull
    private String mac;
    @NotNull
    private String ipv4;
    @NotNull
    private String publicIpv4;
    private String ipv6;

    public NetworkInfo(NetworkDetail networkDetail) {
        this.iface = networkDetail.getIface();
        this.mac = networkDetail.getMac();
        this.ipv4 = networkDetail.getIpv4();
        this.publicIpv4 = networkDetail.getPubicIpv4();
        this.ipv6 = networkDetail.getIpv6();
    }
}
