import{InvalidOperationError as n}from"../InvalidOperationError.js";import{assertNever as e}from"../utilities/checkArg.js";export var Relationship;!function(e){e.create=function(r){if(!e.factory)throw new n("Cannot create relationship: no relationship factory has been registered.");return e.factory.create(r)}}(Relationship||(Relationship={}));export function toEsriApiCardinality(n){if(!n)return;return!!t(n)?n:r(n,new Error("Unknown relationship cardinality type."))}export function fromEsriApiCardinality(n){if(!n)return;return!!r(n)?n:t(n,new Error("Unknown relationship cardinality type."))}function r(n,r){const t=n;switch(t){case"esriRelCardinalityOneToOne":return"one-to-one";case"esriRelCardinalityOneToMany":return"one-to-many";case"esriRelCardinalityManyToOne":return"many-to-one";case"esriRelCardinalityManyToMany":return"many-to-many";default:return e(t,r)}}function t(n,r){const t=n;switch(t){case"one-to-one":return"esriRelCardinalityOneToOne";case"one-to-many":return"esriRelCardinalityOneToMany";case"many-to-one":return"esriRelCardinalityManyToOne";case"many-to-many":return"esriRelCardinalityManyToMany";default:return e(t,r)}}