package com.friday.tooldriver.po.executor;

import com.friday.operation.api.executor.constant.ExecutorState;
import com.friday.operation.api.executor.dto.executor.ExecutorDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Author YaoYao
 * @Date Created In 10:47 2023/3/8
 * @Description
 * @Modified By
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ExecutorPo {
    /**
     * 主键ID
     */
    private Integer id;
    /**
     * 中控租户唯一键
     */
    private Integer ocTenantKey;
    /**
     * 机器IP
     */
    private String ip;
    /**
     * 机器用户
     */
    private String user;
    /**
     * 状态{@link ExecutorState}
     */
    private String state;
    /**
     * 是否有效
     */
    private Boolean valid;
    /**
     * 备注
     */
    private String remark;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    public ExecutorDto transferToExecutorDto(){
        return ExecutorDto.builder()
                .tenantKey(String.valueOf(ocTenantKey))
                .key(String.valueOf(id))
                .ip(ip)
                .user(user)
                .state(state)
                .build();
    }
}
