import{assertNever as i,checkArg as e}from"../utilities/checkArg.js";import{CodedValueDomain as n}from"./CodedValueDomain.js";import{InheritedDomain as o}from"./InheritedDomain.js";import{RangeDomain as r}from"./RangeDomain.js";export var DomainType;function a(e,n){const o=e;switch(o){case"inherited":return"inherited";case"range":return"range";case"coded-value":return"codedValue";default:return i(o,n)}}function t(e,n){const o=e;switch(o){case"inherited":return"inherited";case"range":return"range";case"codedValue":return"coded-value";default:return i(o,n)}}!function(i){i.fromEsriApiDomainType=function(i){return!!t(i)?i:a(i,new Error("Unrecognized domain type."))},i.toEsriApiDomainType=function(i){return!!a(i)?i:t(i,new Error("Unrecognized domain type."))}}(DomainType||(DomainType={}));export var Domain;!function(i){i.toEsriApiDomain=function(i){switch(e("domainJson",i).isNotMissing(),e("domainJson.type",i.type).satisfies((i=>!!DomainType.toEsriApiDomainType(i))),i.type){case"inherited":return o.toEsriApiInheritedDomain(i);case"range":return r.toEsriApiRangeDomain(i);case"codedValue":return n.toEsriApiCodedValueDomain(i)}},i.applyToEsriApiDomain=function(i,a){switch(e("domainJson",i).isNotMissing(),e("domain",a).isNotMissing(),e("domainJson.type",i.type).satisfies((i=>!!DomainType.toEsriApiDomainType(i))),e("domain.type",a.type).satisfies((e=>i.type===DomainType.fromEsriApiDomainType(e))),i.type){case"inherited":o.applyToEsriApiInheritedDomain(i,a);break;case"range":r.applyToEsriApiRangeDomain(i,a);break;case"codedValue":n.applyToEsriApiCodedValueDomain(i,a)}},i.fromEsriApiDomain=function(i){return e("domain",i).isNotMissing(),i.toJSON()}}(Domain||(Domain={}));