package v1

// DunsTokenResp duns token response
type DunsTokenResp struct {
	Error       DunsError `json:"error"`
	AccessToken string    `json:"access_token"`
}
type DunsError struct {
	ErrorMessage string `json:"errorMessage"`
	ErrorCode    string `json:"errorCode"`
}

// CompanyInfoResp company info response
type CompanyInfoResp struct {
	Error           DunsError         `json:"error"`
	SearchCandidate []SearchCandidate `json:"searchCandidates"`
}

type SearchCandidate struct {
	PrimaryName          string       `json:"primaryName"`
	CountryISOAlpha2Code string       `json:"countryISOAlpha2Code"`
	EntityType           string       `json:"entityType"`
	EntityID             string       `json:"entityID"`
	Title                string       `json:"title"`
	RiskIcon             []RiskIcon   `json:"riskIcons"`
	MatchedNames         MatchedName  `json:"matchedName"`
	MatchQuality         MatchQuality `json:"matchQuality"`
}
type RiskIcon struct {
	Code string `json:"code"`
}
type MatchedName struct {
	Name     string `json:"name"`
	NameType string `json:"nameType"`
}

type MatchQuality struct {
	MatchScore string `json:"matchScore"`
}

// CompanySanctionResp company sanction response

type OrganizationName struct {
	NameType string `json:"nameType"`
	Name     string `json:"name"`
}

type SanctionReference struct {
	Reference    string `json:"reference"`
	ProviderName string `json:"providerName"`
	ProviderCode string `json:"providerCode"`
	Description  string `json:"description"`
	Status       string `json:"status"`
	StartYear    int    `json:"startYear"`
	StartMonth   int    `json:"startMonth"`
	StartDay     int    `json:"startDay"`
	EndYear      int    `json:"endYear"`
	EndMonth     int    `json:"endMonth"`
	EndDay       int    `json:"endDay"`
}

type DataProvider struct {
	SourceName string `json:"sourceName"`
}

type WatchListContent struct {
	Status             string              `json:"status"`
	SanctionReferences []SanctionReference `json:"sanctionReferences"`
	DataProviders      []DataProvider      `json:"dataProviders"`
	Notes              string              `json:"notes"`
}

type MatchedProfile struct {
	EntityID          string             `json:"entityID"`
	OrganizationNames []OrganizationName `json:"organizationNames"`
	WatchListContent  WatchListContent   `json:"watchListContent,omitempty"`
}

type CompanySanctionResp struct {
	MatchedProfile []MatchedProfile `json:"matchedProfiles"`
}

// CompanyOthersResp company others response
type CompanyOthersResp struct {
	Organization Organization `json:"organization"`
}
type Organization struct {
	Duns              string            `json:"duns"`
	PrimaryName       string            `json:"primaryName"`
	DunsControlStatus DunsControlStatus `json:"dunsControlStatus"`
}
type DunsControlStatus struct {
	OperatingStatus         OperatingStatus         `json:"operatingStatus"`
	DetailedOperatingStatus DetailedOperatingStatus `json:"DetailedOperatingStatus"`
}
type OperatingStatus struct {
	Description string `json:"description"`
	DnbCode     int    `json:"dnbCode"`
}
type DetailedOperatingStatus struct {
	Description string `json:"description"`
	DnbCode     int    `json:"dnbCode"`
}

// IDRResp IDR response
type IDRResp struct {
	MatchCandidate []MatchCandidate `json:"matchCandidates"`
}
type MatchCandidate struct {
	Organization Org `json:"organization"`
}

type Org struct {
	PrimaryName         string                `json:"primaryName"`
	PrimaryAddress      PrimaryAddress        `json:"primaryAddress"`
	RegistrationNumbers []RegistrationNumbers `json:"registrationNumbers"`
	DunsControlStatus   DunsControlStatus     `json:"dunsControlStatus"`
}

type PrimaryAddress struct {
	AddressCountry AddressCountry `json:"addressCountry"`
	AddressRegion  AddressRegion  `json:"addressRegion"`
	StreetAddress  StreetAddress  `json:"streetAddress"`
}

type AddressCountry struct {
	IsoAlpha2Code string `json:"isoAlpha2Code"`
	Name          string `json:"name"`
}

type AddressRegion struct {
	Name string `json:"name"`
}

type StreetAddress struct {
	Line1 string `json:"line1"`
	Line2 string `json:"line2"`
}

type RegistrationNumbers struct {
	RegistrationNumber string `json:"registrationNumber"`
}
