use crate::LegalRelation;
use super::legacy_base::{
Address, Building, BuildingRight, BuildingWrapper, CharacteristicCode, CharacteristicWrapper,
LegacyId, Parcel, ParcelWrapper, Proceeding, PropertyIdentification, ReportedShare,
SubjectNameForm, UnitWrapper, YesNo,
};
#[derive(Clone, Default, Eq, PartialEq)]
pub struct LegacySubjectIdentification {
pub entries: Vec<LegacySubjectIdentifier>,
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum LegacySubjectIdentifier {
Id(LegacyId),
PersonalNumber6(String),
PersonalNumber7(String),
CompanyId(String),
CompanyIdSuffix(String),
Partner1Id(LegacyId),
Partner2Id(LegacyId),
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct LegacyReportDistrict {
pub nuts4: Option<String>,
pub name: Option<String>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct LegacyReportCodeName {
pub code: u32,
pub name: String,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewReport {
pub requested_legal_relation: LegalRelation,
pub subject: OwnershipOverviewSubject,
pub districts: Vec<OwnershipOverviewDistrictGroup>,
pub territorial_restriction: String,
pub workplace: String,
pub valid_at: String,
pub created_by: String,
pub free_access: String,
pub created_at: String,
pub output_info: Option<String>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewSubject {
pub characteristic: CharacteristicWrapper,
pub name: SubjectNameForm,
pub identification: LegacySubjectIdentification,
pub addresses: Vec<Address>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewDistrictGroup {
pub district: LegacyReportDistrict,
pub municipalities: Vec<OwnershipOverviewMunicipalityGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewMunicipalityGroup {
pub municipality: LegacyReportCodeName,
pub cadastral_areas: Vec<OwnershipOverviewCadastralAreaGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewCadastralAreaGroup {
pub cadastral_area: LegacyReportCodeName,
pub legal_relations: Vec<OwnershipOverviewLegalRelationGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewLegalRelationGroup {
pub legal_relation: LegalRelation,
pub records: Vec<OwnershipOverviewRecord>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewRecord {
pub ownership_sheet_number: String,
pub properties: PropertyIdentification,
pub share: ReportedShare,
pub ownership_sheet_id: LegacyId,
pub legal_relation_sheet: String,
pub proceeding: Proceeding,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipOverviewWithPropertiesReport {
pub requested_legal_relation: LegalRelation,
pub subject: OwnershipPropertiesSubject,
pub districts: Vec<OwnershipPropertiesDistrictGroup>,
pub output_info: String,
pub proceeding: Proceeding,
pub created_by: String,
pub created_at: String,
pub valid_at: String,
pub workplace: String,
pub free_access: String,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipPropertiesSubject {
pub characteristic: CharacteristicCode,
pub name: SubjectNameForm,
pub identification: LegacySubjectIdentification,
pub addresses: Vec<Address>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipPropertiesDistrictGroup {
pub district: LegacyReportDistrict,
pub municipalities: Vec<OwnershipPropertiesMunicipalityGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipPropertiesMunicipalityGroup {
pub municipality: LegacyReportCodeName,
pub cadastral_areas: Vec<OwnershipPropertiesCadastralAreaGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipPropertiesCadastralAreaGroup {
pub cadastral_area: LegacyReportCodeName,
pub records: Vec<OwnershipPropertiesRecord>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipPropertiesRecord {
pub share: ReportedShare,
pub ownership_sheet_number: String,
pub parcels: Vec<OwnershipParcel>,
pub buildings: Vec<OwnershipBuilding>,
pub units: Vec<OwnershipUnit>,
pub sources: Vec<OwnershipSource>,
pub building_rights: Vec<OwnershipBuildingRight>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipParcel {
pub use_description: Option<String>,
pub parcel: ParcelWrapper,
pub part: String,
pub area: u32,
pub area_determination: String,
pub land_kind: String,
pub protection: YesNo,
pub map: String,
pub building_on_parcel: Option<BuildingWrapper>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipBuilding {
pub house_number_buildings: Vec<Building>,
pub parcel: Parcel,
pub building_type: String,
pub proceeding: Proceeding,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipUnit {
pub unit: UnitWrapper,
pub use_description: String,
pub building_share: ReportedShare,
pub building: BuildingWrapper,
pub proceeding: Proceeding,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipSource {
pub origin: String,
pub parcels: Vec<OwnershipSourceParcel>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipSourceParcel {
pub parcel: ParcelWrapper,
pub part: String,
pub kind: String,
pub area: u32,
pub original_cadastral_area: OwnershipOriginalCadastralArea,
pub current_parcel: ParcelWrapper,
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct OwnershipOriginalCadastralArea {
pub cadastral_area: Option<LegacyReportCodeName>,
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct OwnershipBuildingRight {
pub entries: Vec<OwnershipBuildingRightEntry>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct OwnershipBuildingRightEntry {
pub building_right: BuildingRight,
pub purposes: Option<Vec<String>>,
pub valid_until: String,
pub proceeding: Proceeding,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsRecordReport {
pub query: RightsRecordQuery,
pub exact_match: Option<RightsExactMatch>,
pub mismatch: Option<RightsMismatch>,
pub partial_match: Option<RightsPartialMatch>,
pub valid_at: String,
pub created_by: String,
pub free_access: String,
pub created_at: String,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsRecordQuery {
pub subject_kind: String,
pub subject_name: String,
pub company_id: String,
pub surname: String,
pub given_name: String,
pub personal_number: String,
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct RightsExactMatch {
pub ownership: Option<RightsOwnership>,
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct RightsMismatch {
pub text: Option<String>,
}
#[derive(Clone, Default, Eq, PartialEq)]
pub struct RightsPartialMatch {
pub details: Option<RightsPartialMatchDetails>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsPartialMatchDetails {
pub text: String,
pub subjects: Vec<RightsPartialSubject>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsPartialSubject {
pub name: SubjectNameForm,
pub identification: LegacySubjectIdentification,
pub addresses: Vec<Address>,
pub characteristic: Option<CharacteristicWrapper>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsOwnership {
pub identification_match: RightsIdentificationMatch,
pub subjects: Vec<RightsSubject>,
pub text: String,
}
#[derive(Clone, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum RightsIdentificationMatch {
Matches,
Other(String),
}
impl RightsIdentificationMatch {
pub fn from_raw(raw: String) -> Self {
match raw.as_str() {
"a" => Self::Matches,
_ => Self::Other(raw),
}
}
pub fn as_str(&self) -> &str {
match self {
Self::Matches => "a",
Self::Other(raw) => raw,
}
}
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsSubject {
pub name: SubjectNameForm,
pub identification: LegacySubjectIdentification,
pub addresses: Vec<Address>,
pub characteristic: Option<CharacteristicWrapper>,
pub legal_relations: Vec<RightsLegalRelationGroup>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsLegalRelationGroup {
pub legal_relation: LegalRelation,
pub districts: Vec<RightsDistrict>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsDistrict {
pub district: LegacyReportDistrict,
pub municipalities: Vec<RightsMunicipality>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsMunicipality {
pub municipality: LegacyReportCodeName,
pub cadastral_areas: Vec<RightsCadastralArea>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsCadastralArea {
pub cadastral_area: LegacyReportCodeName,
pub records: Vec<RightsOwnershipRecord>,
}
#[derive(Clone, Eq, PartialEq)]
pub struct RightsOwnershipRecord {
pub ownership_sheet_number: String,
pub legal_relation_sheet: String,
pub ownership_sheet_id: LegacyId,
pub properties: PropertyIdentification,
pub proceeding: Proceeding,
pub share: ReportedShare,
}