package model

import "testing"

func TestDemoRequestNormalizeAndValidate(t *testing.T) {
	req := &DemoRequest{
		Name:             " Alice ",
		OrganizationName: " Sendico ",
		Phone:            " +1 234 ",
		WorkEmail:        " demo@sendico.io ",
		PayoutVolume:     " 100k ",
		Comment:          " Excited ",
	}

	req.Normalize()
	if err := req.Validate(); err != nil {
		t.Fatalf("expected request to be valid, got error: %v", err)
	}

	if req.Name != "Alice" || req.OrganizationName != "Sendico" || req.Phone != "+1 234" || req.WorkEmail != "demo@sendico.io" || req.PayoutVolume != "100k" || req.Comment != "Excited" {
		t.Fatalf("normalize failed: %+v", req)
	}
}

func TestDemoRequestValidateMissing(t *testing.T) {
	req := &DemoRequest{}
	req.Normalize()
	if err := req.Validate(); err == nil {
		t.Fatalf("expected validation error for empty request")
	}
}
