package org.mockserver.serialization.model;

import org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString;
import org.mockserver.model.TcpChaosProfile;

public class TcpChaosProfileDTO extends ObjectWithReflectiveEqualsHashCodeToString implements DTO<TcpChaosProfile> {

    private Long latencyMs;
    private Boolean down;
    private Long bandwidthBytesPerSec;
    private Boolean slowClose;
    private Boolean timeout;
    private Boolean resetPeer;
    private Integer slicerChunkSize;
    private Long limitDataBytes;

    public TcpChaosProfileDTO(TcpChaosProfile tcpChaosProfile) {
        if (tcpChaosProfile != null) {
            latencyMs = tcpChaosProfile.getLatencyMs();
            down = tcpChaosProfile.getDown();
            bandwidthBytesPerSec = tcpChaosProfile.getBandwidthBytesPerSec();
            slowClose = tcpChaosProfile.getSlowClose();
            timeout = tcpChaosProfile.getTimeout();
            resetPeer = tcpChaosProfile.getResetPeer();
            slicerChunkSize = tcpChaosProfile.getSlicerChunkSize();
            limitDataBytes = tcpChaosProfile.getLimitDataBytes();
        }
    }

    public TcpChaosProfileDTO() {
    }

    @Override
    public TcpChaosProfile buildObject() {
        return TcpChaosProfile.tcpChaosProfile()
            .withLatencyMs(latencyMs)
            .withDown(down)
            .withBandwidthBytesPerSec(bandwidthBytesPerSec)
            .withSlowClose(slowClose)
            .withTimeout(timeout)
            .withResetPeer(resetPeer)
            .withSlicerChunkSize(slicerChunkSize)
            .withLimitDataBytes(limitDataBytes);
    }

    public Long getLatencyMs() {
        return latencyMs;
    }

    public TcpChaosProfileDTO setLatencyMs(Long latencyMs) {
        this.latencyMs = latencyMs;
        return this;
    }

    public Boolean getDown() {
        return down;
    }

    public TcpChaosProfileDTO setDown(Boolean down) {
        this.down = down;
        return this;
    }

    public Long getBandwidthBytesPerSec() {
        return bandwidthBytesPerSec;
    }

    public TcpChaosProfileDTO setBandwidthBytesPerSec(Long bandwidthBytesPerSec) {
        this.bandwidthBytesPerSec = bandwidthBytesPerSec;
        return this;
    }

    public Boolean getSlowClose() {
        return slowClose;
    }

    public TcpChaosProfileDTO setSlowClose(Boolean slowClose) {
        this.slowClose = slowClose;
        return this;
    }

    public Boolean getTimeout() {
        return timeout;
    }

    public TcpChaosProfileDTO setTimeout(Boolean timeout) {
        this.timeout = timeout;
        return this;
    }

    public Boolean getResetPeer() {
        return resetPeer;
    }

    public TcpChaosProfileDTO setResetPeer(Boolean resetPeer) {
        this.resetPeer = resetPeer;
        return this;
    }

    public Integer getSlicerChunkSize() {
        return slicerChunkSize;
    }

    public TcpChaosProfileDTO setSlicerChunkSize(Integer slicerChunkSize) {
        this.slicerChunkSize = slicerChunkSize;
        return this;
    }

    public Long getLimitDataBytes() {
        return limitDataBytes;
    }

    public TcpChaosProfileDTO setLimitDataBytes(Long limitDataBytes) {
        this.limitDataBytes = limitDataBytes;
        return this;
    }
}
