export default function (publicProps) {
    const { mainSize, derrickSize, partSize, platformSize, strataSizeInit } = publicProps
    let { strataSize, pumpPoolSize, pumpSize, poolSize, endPoints } = publicProps
    function pumpPoolSizeInit () {
        return {
            width: mainSize.width - (strataSize.secondLeft + strataSize.width),
            height: 500
        }
    }
    pumpPoolSize = pumpPoolSizeInit()
    function pumpSizeInit () {
        return {
            pumpHeight: derrickSize.height / 6,
            pumpWidthZero: 12,
            pumpWidthTotal: undefined,
            pumpSpace: 30,
            valueMax: 200,
            padLeft: 20,
            padRight: 60,
            vTextHeight: 40,
            vTextWidth: 130,
            vTextFontSize: 30,

            pumpTextSize: 20
        }
    }
    pumpSize = pumpSizeInit()
    function poolSizeInit () {
        return {
            width: 160,
            height: 66,
            ellipseScaleY: 0.15,
            pool1ValueMax: 200,
            pool2ValueMax: 200
        }
    }
    poolSize = poolSizeInit()
    // relative Px
    function endPointsInit () {
        return {
            fromPlat: { x: 1 + pumpSize.vTextHeight / 2, y: partSize.topRed.height + derrickSize.height },
            topToRight: { x: undefined, y: undefined },

            pump1Left: { x: undefined, y: pumpSize.pumpHeight / 2 },
            pump2Left: { x: undefined, y: undefined },
            pump3Left: {},
            pump1Right: {},
            pump2Right: {},
            pump3Right: {},

            rightBottom: {},

            pool1: {},
            pool2: {},

            ckll: {},

            platRight: { x: undefined, y: partSize.topRed.height + derrickSize.height + platformSize.height }
        }
    }
    endPoints = endPointsInit()
    function calEndPoints () {
        strataSize = strataSizeInit()
        pumpPoolSize = pumpPoolSizeInit()
        pumpSize = pumpSizeInit()
        endPoints = endPointsInit()
        poolSize = poolSizeInit()

        const topToPumpLeft = 70

        endPoints.topToRight.x = endPoints.fromPlat.x
        endPoints.topToRight.y = 96

        endPoints.pump1Left.x = endPoints.topToRight.x + topToPumpLeft
        endPoints.pump2Left = { x: endPoints.pump1Left.x, y: endPoints.topToRight.y }
        endPoints.pump3Left = {
            x: endPoints.pump1Left.x,
            y: (endPoints.topToRight.y - endPoints.pump1Left.y) * 2 + endPoints.pump1Left.y
        }
        endPoints.pump1Right = { x: pumpPoolSize.width - 4, y: endPoints.pump1Left.y }
        endPoints.pump2Right = { x: pumpPoolSize.width - 4, y: endPoints.pump2Left.y }
        endPoints.pump3Right = { x: pumpPoolSize.width - 4, y: endPoints.pump3Left.y }

        endPoints.rightBottom = { x: endPoints.pump3Right.x, y: endPoints.pump3Right.y + 125 }
        endPoints.pool1 = { x: endPoints.pump1Left.x + poolSize.width / 2, y: endPoints.rightBottom.y }
        endPoints.pool2 = { x: endPoints.pool1.x, y: endPoints.pool1.y + poolSize.height + 50 }

        endPoints.ckll = { x: 30, y: endPoints.pool2.y }
        endPoints.platRight.x = endPoints.ckll.x

        pumpSize.pumpWidthTotal = (endPoints.pump1Right.x - endPoints.pump1Left.x) - pumpSize.padLeft - pumpSize.padRight
    }
    calEndPoints()

    return {
        pumpPoolSize,
        pumpSize,
        poolSize,
        endPoints,

        calEndPoints
    }
}
