@namespace Lumeo.Docs.Shared

@using Lumeo.Services

<Stack Gap="4" Class="py-4">
    <Stack Gap="2">
        <Label>Name</Label>
        <Input @bind-Value="_name" Placeholder="Enter your name..." />
    </Stack>
    <Stack Gap="2">
        <Label>Email</Label>
        <Input @bind-Value="_email" Placeholder="Enter your email..." />
    </Stack>
    <Flex Justify="end" Gap="2" Class="pt-2">
        <Button Variant="Button.ButtonVariant.Outline" OnClick="() => Overlay.Cancel()">Cancel</Button>
        <Button OnClick="Submit">Submit</Button>
    </Flex>
</Stack>

@code {
    [CascadingParameter] public OverlayReference Overlay { get; set; } = default!;

    private string _name = "";
    private string _email = "";

    private void Submit()
    {
        Overlay.Close(new ProfileResult(_name, _email));
    }

    public record ProfileResult(string Name, string Email)
    {
        public override string ToString() => $"Name: {Name}, Email: {Email}";
    }
}
