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 {
	Duns                string                `json:"duns"`
	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"`
	AddressLocality struct {
		Name string `json:"name"`
	} `json:"addressLocality"`
	StreetAddress       StreetAddress `json:"streetAddress"`
	MinorTownName       string        `json:"minorTownName"`
	PostalCode          string        `json:"postalCode"`
	IsRegisteredAddress *bool         `json:"isRegisteredAddress"`
}

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"`
}

type CompanyInfoPrincipalReq struct {
	OrganizationPri OrganizationPri `json:"organization"`
}

type OrganizationPri struct {
	PrimaryName     string `json:"primaryName"`
	TradeStyleNames []struct {
		Name string `json:"name"`
	} `json:"tradeStyleNames"`
	RegistrationNumbers []struct {
		RegistrationNumber string `json:"registrationNumber"`
		TypeDescription    string `json:"typeDescription"`
	} `json:"registrationNumbers"`
	BusinessEntityType struct {
		Description string `json:"description"`
	} `json:"businessEntityType"`
	IncorporatedDate  string `json:"incorporatedDate"`
	DunsControlStatus struct {
		OperatingStatus struct {
			Description string `json:"description"`
		} `json:"operatingStatus"`
		IsMarketable *bool `json:"isMarketable"`
	} `json:"dunsControlStatus"`
	IsStandalone      *bool          `json:"isStandalone"`
	IndustryCodes     []IndustryCode `json:"industryCodes"`
	PrimaryAddress    PrimaryAddress `json:"primaryAddress"`
	PrimaryAddressStr string         `json:"primaryAddressStr"`
	NumberOfEmployees []struct {
		Value *int `json:"value"`
	} `json:"numberOfEmployees"`
	StockExchanges []StockExchange `json:"stockExchanges"`
	WebsiteAddress []struct {
		Url string `json:"url"`
	} `json:"websiteAddress"`
	Telephone []struct {
		TelephoneNumber string `json:"telephoneNumber"`
		IsdCode         string `json:"isdCode"`
	} `json:"telephone"`
	Email []struct {
		Address string `json:"address"`
	} `json:"email"`
	IsAgent           *bool `json:"isAgent"`
	IsExporter        *bool `json:"isExporter"`
	IsImporter        *bool `json:"isImporter"`
	PrincipalsSummary struct {
		CurrentPrincipalsCount int `json:"currentPrincipalsCount"`
	} `json:"principalsSummary"`
	MostSeniorPrincipal  Principal   `json:"mostSeniorPrincipal"`
	CurrentPrincipals    []Principal `json:"currentPrincipals"`
	CurrentPrincipalsStr string      `json:"currentPrincipalsStr"`
	Financials           []Financial `json:"financials"`
}

type IndustryCode struct {
	Code        string `json:"code"`
	Description string `json:"description"`
	Priority    int    `json:"priority"`
	TypeDnBCode int    `json:"typeDnBCode"`
}

type StockExchange struct {
	ExchangeCountry struct {
		IsoAlpha2Code string `json:"isoAlpha2Code"`
	} `json:"exchangeCountry"`
	ExchangeName struct {
		Description string `json:"description"`
	} `json:"exchangeName"`
	IsPrimary  *bool  `json:"isPrimary"`
	TickerName string `json:"tickerName"`
}

type Principal struct {
	FullName  string `json:"fullName"`
	JobTitles []struct {
		Title string `json:"title"`
	} `json:"jobTitles"`
}

type Financial struct {
	YearlyRevenue            []YearlyRevenue `json:"yearlyRevenue"`
	UnitCode                 string          `json:"unitCode"`
	FinancialStatementToDate string          `json:"financialStatementToDate"`
}

type YearlyRevenue struct {
	Value    *float64 `json:"value"`
	Currency string   `json:"currency"`
}
