@openfisca/json-model
Version:
Library to handle informations extracted in JSON or YAML format from OpenFisca parameters, variables, etc
41 lines (40 loc) • 1.18 kB
TypeScript
export type Entity = GroupEntity | PersonEntity;
export interface EntityBase {
documentation?: string;
is_person?: boolean;
key: string;
key_plural?: string;
label?: string;
label_plural?: string;
}
export type EntityByKey = {
[key: string]: Entity;
};
export interface GroupEntity extends EntityBase {
composition_label?: string;
is_person?: false;
is_single_label?: string;
roles: Role[];
}
export interface PersonEntity extends EntityBase {
is_person: true;
}
export interface Role extends RoleBase {
adult?: boolean;
child?: boolean;
subroles?: SubRole[];
}
export interface RoleBase {
documentation?: string;
key: string;
key_plural?: string;
label?: string;
max?: number;
}
type SubRole = RoleBase;
export declare function getRolePersonsIdKey(role: Role | SubRole): string;
export declare function isAdultRole(role: Role): boolean;
export declare function isChildRole(role: Role): boolean;
export declare function iterFlattenedRole(role: Role): Generator<Role | SubRole, void, undefined>;
export declare function iterSubRole(subrole: SubRole): Generator<SubRole, void, undefined>;
export {};