﻿var server = WireMockServer.Start();
server
    .Given(Request.Create()
        .UsingMethod("POST")
        .WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post2", false, WireMock.Matchers.MatchOperator.Or))
        .WithBody(new JsonPartialMatcher(
            value: new
            {
                city = "City",
                country = "Country"
            },
            ignoreCase: false,
            regex: false
        ))
    )
    .WithGuid("1b731398-4a5b-457f-a6e3-d65e541c428f")
    .RespondWith(Response.Create()
        .WithBody(@"Line1
Some ""value"" in Line2")
    );

server
    .Given(Request.Create()
        .UsingMethod("POST")
        .WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo2", false, WireMock.Matchers.MatchOperator.Or))
        .WithParam("p2", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "abc"))
        .WithHeader("h1", "W/\"234f2q3r\"", true)
    )
    .WithGuid("4126dec8-470b-4eff-93bb-c24f83b8b1fd")
    .RespondWith(Response.Create()
        .WithStatusCode("201")
        .WithHeader("hk", "hv")
        .WithHeader("ETag", "W/\"168d8e\"")
        .WithBody("2")
    );

server
    .Given(Request.Create()
        .UsingMethod("POST")
        .WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post1", false, WireMock.Matchers.MatchOperator.Or))
        .WithBody(new JsonMatcher(
            value: new
            {
                city = "Amsterdam",
                country = "The Netherlands"
            },
            ignoreCase: false,
            regex: false
        ))
    )
    .WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
    .RespondWith(Response.Create()
    );

server
    .Given(Request.Create()
        .UsingMethod("DELETE")
        .WithUrl(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "https://localhost/test", false, WireMock.Matchers.MatchOperator.Or))
    )
    .WithGuid("c9929240-7ae8-4a5d-8ed8-0913479f6eeb")
    .RespondWith(Response.Create()
        .WithStatusCode(306)
        .WithBodyAsJson(new
        {
            @as = 1,
            b = 1.2,
            d = true,
            e = false,
            f = new [] { 1, 2, 3, 4 },
            g = new
            {
                z1 = 1,
                z2 = 2,
                z3 = new [] { "a", "b", "c" },
                z4 = new []
                {
                    new
                    {
                        a = 1,
                        b = 2
                    },
                    new
                    {
                        a = 2,
                        b = 3
                    }
                }
            },
            date_field = "2023-05-08T11:20:19",
            string_field_with_date = "2021-03-13T21:04:00Z",
            multiline_text = @"This
is
multiline
text
"
        })
    );

server
    .Given(Request.Create()
        .UsingMethod("GET")
        .WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo1", false, WireMock.Matchers.MatchOperator.Or))
        .WithParam("p1", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "xyz"))
    )
    .WithGuid("f74fd144-df53-404f-8e35-da22a640bd5f")
    .RespondWith(Response.Create()
        .WithStatusCode(200)
        .WithBody("1")
    );

