package com.sunyard.chsm.pool;

import com.sunyard.chsm.sdf.adapter.SdfApiAdapter;
import lombok.Data;
import org.apache.commons.pool2.impl.GenericObjectPool;

/**
 * @author liulu
 * @since 2024/11/5
 */
@Data
public class DeviceContext {

    private String ip;
    private Integer port;
    private String manufacturer;
    private String model;
    private Integer encKeyIdx;
    private String accessCredentials;
    private String jnaLibName;
    private String deviceSerial;
    private String pubKey;
    private String encTmk;
    private Integer weight;

    private SdfApiAdapter sdfApiAdapter;
    private GenericObjectPool<TMKContext> pool;


    public String getUnionId() {
        return String.join("-", deviceSerial, pubKey);
    }

    public String getIpPort() {
        return String.join("-", ip, String.valueOf(port));
    }

}
