from ocdskit.schema import get_schema_fields
from tests import load


def test_bods_0_4():
    schema = load("bods", "schema-0-4-0.json")

    actual = {field.path_components for field in get_schema_fields(schema) if not field.definition}

    # 139
    assert actual == {
        ("annotations", "createdBy"),
        ("annotations", "createdBy", "name"),
        ("annotations", "createdBy", "uri"),
        ("annotations", "creationDate"),
        ("annotations", "description"),
        ("annotations", "motivation"),
        ("annotations", "statementPointerTarget"),
        ("annotations", "transformedContent"),
        ("annotations", "url"),
        ("annotations",),
        ("declaration",),
        ("declarationSubject",),
        ("publicationDetails", "bodsVersion"),
        ("publicationDetails", "license"),
        ("publicationDetails", "publicationDate"),
        ("publicationDetails", "publisher"),
        ("publicationDetails", "publisher", "name"),
        ("publicationDetails", "publisher", "url"),
        ("publicationDetails",),
        ("recordDetails", "addresses"),
        ("recordDetails", "addresses", "address"),
        ("recordDetails", "addresses", "country"),
        ("recordDetails", "addresses", "country", "code"),
        ("recordDetails", "addresses", "country", "name"),
        ("recordDetails", "addresses", "postCode"),
        ("recordDetails", "addresses", "type"),
        ("recordDetails", "alternateNames"),
        ("recordDetails", "birthDate"),
        ("recordDetails", "componentRecords"),
        ("recordDetails", "deathDate"),
        ("recordDetails", "dissolutionDate"),
        ("recordDetails", "entityType"),
        ("recordDetails", "entityType", "details"),
        ("recordDetails", "entityType", "subtype"),
        ("recordDetails", "entityType", "type"),
        ("recordDetails", "formedByStatute"),
        ("recordDetails", "formedByStatute", "date"),
        ("recordDetails", "formedByStatute", "name"),
        ("recordDetails", "foundingDate"),
        ("recordDetails", "identifiers"),
        ("recordDetails", "identifiers", "id"),
        ("recordDetails", "identifiers", "scheme"),
        ("recordDetails", "identifiers", "schemeName"),
        ("recordDetails", "identifiers", "uri"),
        ("recordDetails", "interestedParty"),
        ("recordDetails", "interestedParty", "description"),
        ("recordDetails", "interestedParty", "reason"),
        ("recordDetails", "interests"),
        ("recordDetails", "interests", "beneficialOwnershipOrControl"),
        ("recordDetails", "interests", "details"),
        ("recordDetails", "interests", "directOrIndirect"),
        ("recordDetails", "interests", "endDate"),
        ("recordDetails", "interests", "share"),
        ("recordDetails", "interests", "share", "exact"),
        ("recordDetails", "interests", "share", "exclusiveMaximum"),
        ("recordDetails", "interests", "share", "exclusiveMinimum"),
        ("recordDetails", "interests", "share", "maximum"),
        ("recordDetails", "interests", "share", "minimum"),
        ("recordDetails", "interests", "startDate"),
        ("recordDetails", "interests", "type"),
        ("recordDetails", "isComponent"),
        ("recordDetails", "jurisdiction"),
        ("recordDetails", "jurisdiction", "code"),
        ("recordDetails", "jurisdiction", "name"),
        ("recordDetails", "name"),
        ("recordDetails", "names"),
        ("recordDetails", "names", "familyName"),
        ("recordDetails", "names", "fullName"),
        ("recordDetails", "names", "givenName"),
        ("recordDetails", "names", "patronymicName"),
        ("recordDetails", "names", "type"),
        ("recordDetails", "nationalities"),
        ("recordDetails", "nationalities", "code"),
        ("recordDetails", "nationalities", "name"),
        ("recordDetails", "personType"),
        ("recordDetails", "placeOfBirth"),
        ("recordDetails", "placeOfBirth", "address"),
        ("recordDetails", "placeOfBirth", "country"),
        ("recordDetails", "placeOfBirth", "country", "code"),
        ("recordDetails", "placeOfBirth", "country", "name"),
        ("recordDetails", "placeOfBirth", "postCode"),
        ("recordDetails", "placeOfBirth", "type"),
        ("recordDetails", "politicalExposure"),
        ("recordDetails", "politicalExposure", "details"),
        ("recordDetails", "politicalExposure", "details", "endDate"),
        ("recordDetails", "politicalExposure", "details", "jurisdiction"),
        ("recordDetails", "politicalExposure", "details", "jurisdiction", "code"),
        ("recordDetails", "politicalExposure", "details", "jurisdiction", "name"),
        ("recordDetails", "politicalExposure", "details", "missingInfoReason"),
        ("recordDetails", "politicalExposure", "details", "reason"),
        ("recordDetails", "politicalExposure", "details", "source"),
        ("recordDetails", "politicalExposure", "details", "source", "assertedBy"),
        ("recordDetails", "politicalExposure", "details", "source", "assertedBy", "name"),
        ("recordDetails", "politicalExposure", "details", "source", "assertedBy", "uri"),
        ("recordDetails", "politicalExposure", "details", "source", "description"),
        ("recordDetails", "politicalExposure", "details", "source", "retrievedAt"),
        ("recordDetails", "politicalExposure", "details", "source", "type"),
        ("recordDetails", "politicalExposure", "details", "source", "url"),
        ("recordDetails", "politicalExposure", "details", "startDate"),
        ("recordDetails", "politicalExposure", "status"),
        ("recordDetails", "publicListing"),
        ("recordDetails", "publicListing", "companyFilingsURLs"),
        ("recordDetails", "publicListing", "hasPublicListing"),
        ("recordDetails", "publicListing", "securitiesListings"),
        ("recordDetails", "publicListing", "securitiesListings", "marketIdentifierCode"),
        ("recordDetails", "publicListing", "securitiesListings", "operatingMarketIdentifierCode"),
        ("recordDetails", "publicListing", "securitiesListings", "security"),
        ("recordDetails", "publicListing", "securitiesListings", "security", "id"),
        ("recordDetails", "publicListing", "securitiesListings", "security", "idScheme"),
        ("recordDetails", "publicListing", "securitiesListings", "security", "ticker"),
        ("recordDetails", "publicListing", "securitiesListings", "stockExchangeJurisdiction"),
        ("recordDetails", "publicListing", "securitiesListings", "stockExchangeName"),
        ("recordDetails", "subject"),
        ("recordDetails", "subject", "description"),
        ("recordDetails", "subject", "reason"),
        ("recordDetails", "taxResidencies"),
        ("recordDetails", "taxResidencies", "code"),
        ("recordDetails", "taxResidencies", "name"),
        ("recordDetails", "unspecifiedEntityDetails"),
        ("recordDetails", "unspecifiedEntityDetails", "description"),
        ("recordDetails", "unspecifiedEntityDetails", "reason"),
        ("recordDetails", "unspecifiedPersonDetails"),
        ("recordDetails", "unspecifiedPersonDetails", "description"),
        ("recordDetails", "unspecifiedPersonDetails", "reason"),
        ("recordDetails", "uri"),
        ("recordDetails",),
        ("recordId",),
        ("recordStatus",),
        ("recordType",),
        ("source", "assertedBy"),
        ("source", "assertedBy", "name"),
        ("source", "assertedBy", "uri"),
        ("source", "description"),
        ("source", "retrievedAt"),
        ("source", "type"),
        ("source", "url"),
        ("source",),
        ("statementDate",),
        ("statementId",),
    }


def test_bods_0_3():
    schema = load("bods", "schema-0-3-0.json")

    actual = {field.path_components for field in get_schema_fields(schema)}

    # 138
    assert actual == {
        ("addresses", "address"),
        ("addresses", "country"),
        ("addresses", "postCode"),
        ("addresses", "type"),
        ("addresses",),
        ("alternateNames",),
        ("annotations", "createdBy"),
        ("annotations", "createdBy", "name"),
        ("annotations", "createdBy", "uri"),
        ("annotations", "creationDate"),
        ("annotations", "description"),
        ("annotations", "motivation"),
        ("annotations", "statementPointerTarget"),
        ("annotations", "transformedContent"),
        ("annotations", "url"),
        ("annotations",),
        ("birthDate",),
        ("componentStatementIDs",),
        ("deathDate",),
        ("dissolutionDate",),
        ("entitySubtype", "generalCategory"),
        ("entitySubtype", "localTerm"),
        ("entitySubtype",),
        ("entityType",),
        ("formedByStatute", "date"),
        ("formedByStatute", "name"),
        ("formedByStatute",),
        ("foundingDate",),
        ("identifiers", "id"),
        ("identifiers", "scheme"),
        ("identifiers", "schemeName"),
        ("identifiers", "uri"),
        ("identifiers",),
        ("interestedParty", "describedByEntityStatement"),
        ("interestedParty", "describedByPersonStatement"),
        ("interestedParty", "unspecified"),
        ("interestedParty", "unspecified", "description"),
        ("interestedParty", "unspecified", "reason"),
        ("interestedParty",),
        ("interests", "beneficialOwnershipOrControl"),
        ("interests", "details"),
        ("interests", "directOrIndirect"),
        ("interests", "endDate"),
        ("interests", "share"),
        ("interests", "share", "exact"),
        ("interests", "share", "exclusiveMaximum"),
        ("interests", "share", "exclusiveMinimum"),
        ("interests", "share", "maximum"),
        ("interests", "share", "minimum"),
        ("interests", "startDate"),
        ("interests", "type"),
        ("interests",),
        ("isComponent",),
        ("jurisdiction", "code"),
        ("jurisdiction", "name"),
        ("jurisdiction",),
        ("name",),
        ("names", "familyName"),
        ("names", "fullName"),
        ("names", "givenName"),
        ("names", "patronymicName"),
        ("names", "type"),
        ("names",),
        ("nationalities", "code"),
        ("nationalities", "name"),
        ("nationalities",),
        ("personType",),
        ("placeOfBirth", "address"),
        ("placeOfBirth", "country"),
        ("placeOfBirth", "postCode"),
        ("placeOfBirth", "type"),
        ("placeOfBirth",),
        ("placeOfResidence", "address"),
        ("placeOfResidence", "country"),
        ("placeOfResidence", "postCode"),
        ("placeOfResidence", "type"),
        ("placeOfResidence",),
        ("politicalExposure", "details"),
        ("politicalExposure", "details", "endDate"),
        ("politicalExposure", "details", "jurisdiction"),
        ("politicalExposure", "details", "jurisdiction", "code"),
        ("politicalExposure", "details", "jurisdiction", "name"),
        ("politicalExposure", "details", "missingInfoReason"),
        ("politicalExposure", "details", "reason"),
        ("politicalExposure", "details", "source"),
        ("politicalExposure", "details", "source", "assertedBy"),
        ("politicalExposure", "details", "source", "assertedBy", "name"),
        ("politicalExposure", "details", "source", "assertedBy", "uri"),
        ("politicalExposure", "details", "source", "description"),
        ("politicalExposure", "details", "source", "retrievedAt"),
        ("politicalExposure", "details", "source", "type"),
        ("politicalExposure", "details", "source", "url"),
        ("politicalExposure", "details", "startDate"),
        ("politicalExposure", "status"),
        ("politicalExposure",),
        ("publicationDetails", "bodsVersion"),
        ("publicationDetails", "license"),
        ("publicationDetails", "publicationDate"),
        ("publicationDetails", "publisher"),
        ("publicationDetails", "publisher", "name"),
        ("publicationDetails", "publisher", "url"),
        ("publicationDetails",),
        ("publicListing", "companyFilingsURLs"),
        ("publicListing", "hasPublicListing"),
        ("publicListing", "securitiesListings"),
        ("publicListing", "securitiesListings", "marketIdentifierCode"),
        ("publicListing", "securitiesListings", "operatingMarketIdentifierCode"),
        ("publicListing", "securitiesListings", "security"),
        ("publicListing", "securitiesListings", "security", "id"),
        ("publicListing", "securitiesListings", "security", "idScheme"),
        ("publicListing", "securitiesListings", "security", "ticker"),
        ("publicListing", "securitiesListings", "stockExchangeJurisdiction"),
        ("publicListing", "securitiesListings", "stockExchangeName"),
        ("publicListing",),
        ("replacesStatements",),
        ("source", "assertedBy"),
        ("source", "assertedBy", "name"),
        ("source", "assertedBy", "uri"),
        ("source", "description"),
        ("source", "retrievedAt"),
        ("source", "type"),
        ("source", "url"),
        ("source",),
        ("statementDate",),
        ("statementID",),
        ("statementType",),
        ("subject", "describedByEntityStatement"),
        ("subject",),
        ("taxResidencies", "code"),
        ("taxResidencies", "name"),
        ("taxResidencies",),
        ("unspecifiedEntityDetails", "description"),
        ("unspecifiedEntityDetails", "reason"),
        ("unspecifiedEntityDetails",),
        ("unspecifiedPersonDetails", "description"),
        ("unspecifiedPersonDetails", "reason"),
        ("unspecifiedPersonDetails",),
        ("uri",),
    }
