package com.jiayue.ipfcst.common.data.entity;

import com.jiayue.ipfcst.common.data.abst.AbstractBaseEntity;
import com.jiayue.ipfcst.common.data.constant.enums.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.core.annotation.Order;

import javax.persistence.*;

/**
 * 上报文件通道
 *
 * @author xsl
 * @version 3.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
public class UploadFileChannel extends AbstractBaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @Order(1)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
    private Integer id;

    /**
     * 上报对象ID
     */
    @Column
    private Integer uploadObjectId;

    /**
     * 通道名称
     */
    @Column
    private String channelName;

    /**
     * 通道使用状态
     */
    @Column
    @Enumerated(EnumType.STRING)
    private ChannelStatusEnum channelStatusEnum;

    /**
     * 本地IP
     */
    @Column
    private String localIp;

    /**
     * 本地端口
     */
    @Column
    private String localPort;

    /**
     * 远端IP
     */
    @Column
    private String remoteIp;

    /**
     * 远端端口
     */
    @Column
    private String remotePort;

    /**
     * 上报文件名称长度
     */
    @Column
    @Enumerated(EnumType.STRING)
    private UploadFileNameLengthEnum uploadFileNameLengthEnum;

    /**
     * 上报文件单次传输字节
     */
    @Column
    @Enumerated(EnumType.STRING)
    private UploadFileSingleByteEnum uploadFileSingleByteEnum;

    /**
     * FTP/SFTP用户名/102山东
     */
    @Column
    private String uploadUserName;

    /**
     * FTP/SFTP密码/102山东
     */
    @Column
    private String uploadPassword;

    /**
     * FTP/SFTP服务端路径
     */
    @Column
    private String pathService;

    /**
     * SFTP连接方式
     */
    @Enumerated(EnumType.STRING)
    private SftpConnectModeEnum sftpConnectModeEnum;

    /**
     * SFTP密钥路径
     */
    @Column
    private String keyFilePath;

    /**
     * SFTP密钥密码
     */
    @Column
    private String passPhrase;

    /**
     * 通道备注
     */
    @Column
    private String channelRemarks;

    /**
     * FTP模式
     */
    @Column
    @Enumerated(EnumType.STRING)
    private FtpPassiveModeEnum ftpPassiveModeEnum;

    /**
     * 场站编号（运维标识）
     */
    @Column
    private String stationCode;


    /**
     * 备用字段C 1、多个路径 0和空代表公用一个路径
     * backupC 代表ftp模式下是否有多个上报路径
     */
}
