<commit_before>package mailgun

import (
	"net/http"
	"time"

	"github.com/go-chi/chi"
)

type domainContainer struct {
	Domain              Domain            `json:"domain"`
	ReceivingDNSRecords []DNSRecord       `json:"receiving_dns_records"`
	SendingDNSRecords   []DNSRecord       `json:"sending_dns_records"`
	Connection          *DomainConnection `json:"connection,omitempty"`
	Tracking            *DomainTracking   `json:"tracking,omitempty"`
	TagLimits           *TagLimits        `json:"limits,omitempty"`
}

func (ms *MockServer) addDomainRoutes(r chi.Router) {

	ms.domainList = append(ms.domainList, domainContainer{
		Domain: Domain{
			CreatedAt:    RFC2822Time(time.Now().UTC()),
			Name:         "mailgun.test",
			SMTPLogin:    "<EMAIL>",
			SMTPPassword: "<PASSWORD>",
			Wildcard:     true,
			SpamAction:   SpamActionDisabled,
			State:        "active",
		},
		Connection: &DomainConnection{
			RequireTLS:       true,
			SkipVerification: true,
		},
		TagLimits: &TagLimits{
			Limit: 50000,
			Count: 5000,
		},
		Tracking: &DomainTracking{
			Click: TrackingStatus{Active: true},
			Open:  TrackingStatus{Active: true},
			Unsubscribe: TrackingStatus{
				Active:     false,
				HTMLFooter: "\n<br>\n<p><a href=\"%unsubscribe_url%\">unsubscribe</a></p>\n",
				TextFooter: "\n\nTo unsubscribe click: <%unsubscribe_url%>\n\n",
			},
		},
		ReceivingDNSRecords: []DNSRecord{
			{
				Priority:   "10",
				RecordType: "MX",
				Valid:      "valid",
				Value:      "mxa.mailgun.org",
			},
			{
				Priority:   "10",
				RecordType: "MX",
				Valid:      "valid",
				Value:      "mxb.mailgun.org",
			},
		},
		SendingDNSRecords: []DNSRecord{
			{
				RecordType: "TXT",
				Valid:      "valid",
				Name:       "domain.com",
				Value:      "v=spf1 include:mailgun.org ~all",
			},
			{
				RecordType: "TXT",
				Valid:      "valid",
				Name:       "domain.com",
				Value:      "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUA....",
			},
			{
				RecordType: "CNAME",
				Valid:      "valid",
				Name:       "email.domain.com",
				Value:      "mailgun.org",
			},
		},
	})

	r.Get("/domains", ms.listDomains)
	r.Post("/domains", ms.createDomain)
	r.Get("/domains/{domain}", ms.getDomain)
	//r.Put("/domains/{domain}/verify", ms.verifyDomain)
	r.Delete("/domains/{domain}", ms.deleteDomain)
	//r.Get("/domains/{domain}/credentials", ms.getCredentials)
	//r.Post("/domains/{domain}/credentials", ms.createCredentials)
	//r.Put("/domains/{domain}/credentials/{login}", ms.updateCredentials)
	//r.Delete("/domains/{domain}/credentials/{login}", ms.deleteCredentials)
	r.Get("/domains/{domain}/connection", ms.getConnection)
	r.Put("/domains/{domain}/connection", ms.updateConnection)
	r.Get("/domains/{domain}/tracking", ms.getTracking)
	//r.Put("/domains/{domain}/tracking/{type}", ms.updateTracking)
	r.Get("/domains/{domain}/limits/tag", ms.getTagLimits)
}

func (ms *MockServer) listDomains(w http.ResponseWriter, r *http.Request) {<commit_msg>Add /verify path to mailgun mock server<commit_after>package mailgun

import (
	"net/http"
	"time"

	"github.com/go-chi/chi"
)

type domainContainer struct {
	Domain              Domain            `json:"domain"`
	ReceivingDNSRecords []DNSRecord       `json:"receiving_dns_records"`
	SendingDNSRecords   []DNSRecord       `json:"sending_dns_records"`
	Connection          *DomainConnection `json:"connection,omitempty"`
	Tracking            *DomainTracking   `json:"tracking,omitempty"`
	TagLimits           *TagLimits        `json:"limits,omitempty"`
}

func (ms *MockServer) addDomainRoutes(r chi.Router) {

	ms.domainList = append(ms.domainList, domainContainer{
		Domain: Domain{
			CreatedAt:    RFC2822Time(time.Now().UTC()),
			Name:         "mailgun.test",
			SMTPLogin:    "<EMAIL>",
			SMTPPassword: "<PASSWORD>",
			Wildcard:     true,
			SpamAction:   SpamActionDisabled,
			State:        "active",
		},
		Connection: &DomainConnection{
			RequireTLS:       true,
			SkipVerification: true,
		},
		TagLimits: &TagLimits{
			Limit: 50000,
			Count: 5000,
		},
		Tracking: &DomainTracking{
			Click: TrackingStatus{Active: true},
			Open:  TrackingStatus{Active: true},
			Unsubscribe: TrackingStatus{
				Active:     false,
				HTMLFooter: "\n<br>\n<p><a href=\"%unsubscribe_url%\">unsubscribe</a></p>\n",
				TextFooter: "\n\nTo unsubscribe click: <%unsubscribe_url%>\n\n",
			},
		},
		ReceivingDNSRecords: []DNSRecord{
			{
				Priority:   "10",
				RecordType: "MX",
				Valid:      "valid",
				Value:      "mxa.mailgun.org",
			},
			{
				Priority:   "10",
				RecordType: "MX",
				Valid:      "valid",
				Value:      "mxb.mailgun.org",
			},
		},
		SendingDNSRecords: []DNSRecord{
			{
				RecordType: "TXT",
				Valid:      "valid",
				Name:       "domain.com",
				Value:      "v=spf1 include:mailgun.org ~all",
			},
			{
				RecordType: "TXT",
				Valid:      "valid",
				Name:       "domain.com",
				Value:      "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUA....",
			},
			{
				RecordType: "CNAME",
				Valid:      "valid",
				Name:       "email.domain.com",
				Value:      "mailgun.org",
			},
		},
	})

	r.Get("/domains", ms.listDomains)
	r.Post("/domains", ms.createDomain)
	r.Get("/domains/{domain}", ms.getDomain)
	r.Put("/domains/{domain}/verify", ms.getDomain)
	r.Delete("/domains/{domain}", ms.deleteDomain)
	//r.Get("/domains/{domain}/credentials", ms.getCredentials)
	//r.Post("/domains/{domain}/credentials", ms.createCredentials)
	//r.Put("/domains/{domain}/credentials/{login}", ms.updateCredentials)
	//r.Delete("/domains/{domain}/credentials/{login}", ms.deleteCredentials)
	r.Get("/domains/{domain}/connection", ms.getConnection)
	r.Put("/domains/{domain}/connection", ms.updateConnection)
	r.Get("/domains/{domain}/tracking", ms.getTracking)
	//r.Put("/domains/{domain}/tracking/{type}", ms.updateTracking)
	r.Get("/domains/{domain}/limits/tag", ms.getTagLimits)
}

func (ms *MockServer) listDomains(w http.ResponseWriter, r *http.Request) {
{'fraction_non_alphanumeric': 0.17096176520128012, 'fraction_numerical': 0.0067374094660602995, 'mean_word_length': 3.117891816920943, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4762459', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2063, 'n_words': 336}