import React, { useState } from "react";
import DeckGLMap from "../../DeckGLMap";
import { NativeSelect } from "@equinor/eds-core-react";
export default {
    component: DeckGLMap,
    title: "DeckGLMap / Wells Layer",
};
const Template = (args) => (React.createElement(DeckGLMap, Object.assign({}, args)));
const defaultProps = {
    id: "volve-wells",
    resources: {
        wellsData: "./volve_wells.json",
    },
    bounds: [432150, 6475800, 439400, 6481500],
    layers: [
        {
            "@@type": "WellsLayer",
            data: "@@#resources.wellsData",
        },
    ],
};
const continuousLogsLayer = Object.assign(Object.assign({}, defaultProps.layers[0]), { refine: false, outline: false, logData: "./volve_logs.json", logrunName: "BLOCKING", logName: "PORO", logColor: "Physics" });
// Volve wells default example.
export const VolveWells = Template.bind({});
VolveWells.args = defaultProps;
VolveWells.parameters = {
    docs: {
        description: {
            story: "Volve wells example",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
// Volve wells with logs.
//
export const DiscreteWellLogs = Template.bind({});
DiscreteWellLogs.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { refine: false, outline: false, logData: "./volve_logs.json", logrunName: "BLOCKING", logName: "ZONELOG", logColor: "Stratigraphy" }),
    ] });
DiscreteWellLogs.parameters = {
    docs: {
        description: {
            story: "Volve wells example with well logs.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const ContinuousWellLogs = Template.bind({});
ContinuousWellLogs.args = Object.assign(Object.assign({}, defaultProps), { layers: [continuousLogsLayer] });
ContinuousWellLogs.parameters = {
    docs: {
        description: {
            story: "Volve wells example with well logs.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const DashedWells = Template.bind({});
DashedWells.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: { dash: true }, refine: false, outline: false }),
    ] });
DashedWells.parameters = {
    docs: {
        description: {
            story: "Volve wells example with default dashed well trajectories.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const CustomColoredWells = Template.bind({});
CustomColoredWells.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: { color: [255, 0, 0, 255], dash: [10, 3] }, refine: false, outline: false }),
    ] });
CustomColoredWells.parameters = {
    docs: {
        description: {
            story: "Volve wells example with dashed style and red trajectories, with custom style.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const CustomWidthWells = Template.bind({});
CustomWidthWells.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: { width: 10 }, refine: false, outline: false }),
    ] });
CustomColoredWells.parameters = {
    docs: {
        description: {
            story: "Volve wells example with thick lines.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
function colorCallback(object) {
    if (object["properties"]["name"].match("15/9-F-10"))
        return [0, 0, 0, 0];
    else
        return object["properties"]["color"];
}
function dashCallback(object) {
    if (object["properties"]["name"].match("15/9-19"))
        return [1.5, 1.5];
    else if (object["properties"]["name"] === "15/9-F-15")
        return true;
    else
        return false;
}
function widthCallback(object) {
    if (object["properties"]["name"].match("15/9-F-1"))
        return 3;
    else if (object["properties"]["name"] === "15/9-F-4")
        return 8;
    else
        return 5;
}
export const CallbackStyledWells = Template.bind({});
CallbackStyledWells.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: {
                color: colorCallback,
                dash: dashCallback,
                width: widthCallback,
            }, refine: false, outline: false }),
    ] });
CallbackStyledWells.parameters = {
    docs: {
        description: {
            story: "Volve wells example with trajectory color, width and dash style supplied as callback.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const AllTrajectoryHidden = Template.bind({});
AllTrajectoryHidden.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: { color: [0, 0, 0, 0] }, refine: false, outline: false }),
    ] });
AllTrajectoryHidden.parameters = {
    docs: {
        description: {
            story: "Volve wells example with all trajectory hidden.",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const Wells3d = Template.bind({});
Wells3d.args = Object.assign(Object.assign({}, defaultProps), { views: {
        layout: [1, 1],
        viewports: [
            {
                id: "a",
                show3D: true,
            },
        ],
    } });
Wells3d.parameters = {
    docs: {
        description: {
            story: "3D wells example",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const Wells3dDashed = Template.bind({});
Wells3dDashed.args = Object.assign(Object.assign({}, defaultProps), { layers: [
        Object.assign(Object.assign({}, defaultProps.layers[0]), { lineStyle: { dash: true }, refine: false, outline: false }),
    ], views: {
        layout: [1, 1],
        viewports: [
            {
                id: "a",
                show3D: true,
            },
        ],
    } });
Wells3dDashed.parameters = {
    docs: {
        description: {
            story: "3D dashed wells example",
        },
        inlineStories: false,
        iframeHeight: 500,
    },
};
export const ContinuousColorTable = () => {
    const [colorTable, setColorTable] = useState("Physics");
    const mapProps = React.useMemo(() => {
        return Object.assign(Object.assign({}, defaultProps), { layers: [
                Object.assign(Object.assign({}, continuousLogsLayer), { logColor: colorTable }),
            ] });
    }, [colorTable]);
    const handleOnChange = (event) => {
        var _a;
        setColorTable((_a = event.target) === null || _a === void 0 ? void 0 : _a.value);
    };
    return (React.createElement(React.Fragment, null,
        React.createElement(NativeSelect, { id: "test", label: "Color table", value: colorTable, onChange: handleOnChange },
            React.createElement("option", { key: "Physics" }, "Physics"),
            React.createElement("option", { key: "Rainbow" }, "Rainbow")),
        React.createElement("div", { style: { height: "80vh", position: "relative" } },
            React.createElement(DeckGLMap, Object.assign({}, mapProps)))));
};
//# sourceMappingURL=wellsLayer.stories.js.map