/** @packageDocumentation * @module Codes */ import { GuidString, Id64String } from "@bentley/bentleyjs-core"; import { IModel } from "./IModel"; /** The props that hold the identity of the object defining the uniqueness scope for a set of Code values. * @public */ export declare type CodeScopeProps = Id64String | GuidString; /** The wire format for a Code * @public */ export interface CodeProps { spec: Id64String; scope: CodeScopeProps; value?: string; } /** A three-part structure containing information about the [Code]($docs/bis/intro/codes) of an Element * @public */ export declare class Code implements CodeProps { /** The id of the [CodeSpec]($docs/bis/intro/codes.md#codespec) of the Element */ spec: Id64String; /** The [CodeScope]($docs/bis/intro/codes.md#codescope-property) of the Element */ scope: string; /** The [CodeValue]($docs/bis/intro/codes.md#codevalue-property) of the Element * @note Leading and trailing whitespace is invalid so is automatically trimmed. */ get value(): string; set value(val: string); private _value?; constructor(codeProps: CodeProps); /** Create an empty, non-unique code with no special meaning. */ static createEmpty(): Code; static fromJSON(json?: any): Code; toJSON(): CodeProps; /** @deprecated Use the [[value]] property instead. */ getValue(): string; equals(other: Code): boolean; /** @internal */ static equalCodes(c1: CodeProps, c2: CodeProps): boolean; /** Determine whether this Code is valid. */ static isValid(c: CodeProps): boolean; /** Determine if this code is valid but not otherwise meaningful (and therefore not necessarily unique) */ static isEmpty(c: CodeProps): boolean; } /** Names of the internal BIS CodeSpecs. These names match those specified by the native library. * For other domains, the best practice is to include the domain name or alias as part of the CodeSpec name to ensure global uniqueness. * @public * @see [CodeSpec]($docs/bis/intro/codes.md#codespec) */ export declare enum BisCodeSpec { /** The name of the standard [[CodeSpec]] used when creating *empty* codes. * @see [[Code.createEmpty]] */ nullCodeSpec = "bis:NullCodeSpec", /** @internal */ annotationFrameStyle = "bis:AnnotationFrameStyle", /** @internal */ annotationLeaderStyle = "bis:AnnotationLeaderStyle", /** @internal */ annotationTextStyle = "bis:AnnotationTextStyle", /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem2d]($backend) elements. * @see [AuxCoordSystem2d.createCode]($backend) */ auxCoordSystem2d = "bis:AuxCoordSystem2d", /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem3d]($backend) elements. * @see [AuxCoordSystem3d.createCode]($backend) */ auxCoordSystem3d = "bis:AuxCoordSystem3d", /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystemSpatial]($backend) elements. * @see [AuxCoordSystemSpatial.createCode]($backend) */ auxCoordSystemSpatial = "bis:AuxCoordSystemSpatial", /** The name of the standard [[CodeSpec]] used when creating codes for [CategorySelector]($backend) elements. * @see [CategorySelector.createCode]($backend) */ categorySelector = "bis:CategorySelector", /** @internal */ colorBook = "bis:ColorBook", /** The name of the standard [[CodeSpec]] used when creating codes for [DisplayStyle]($backend) elements. * @see [DisplayStyle.createCode]($backend) */ displayStyle = "bis:DisplayStyle", /** The name of the standard [[CodeSpec]] used when creating codes for [Drawing]($backend) elements. * @see [Drawing.createCode]($backend) */ drawing = "bis:Drawing", /** The name of the standard [[CodeSpec]] used when creating codes for [DrawingCategory]($backend) elements. * @see [DrawingCategory.createCode]($backend) */ drawingCategory = "bis:DrawingCategory", /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSource]($backend) elements. * @note This CodeSpec is not automatically created, so use [ExternalSource.ensureCodeSpec]($backend) to make sure that it exists. * @see [ExternalSource.createCode]($backend) */ externalSource = "bis:ExternalSource", /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSourceAttachment]($backend) elements. * @note This CodeSpec is not automatically created, so use [ExternalSourceAttachment.ensureCodeSpec]($backend) to make sure that it exists. * @see [ExternalSource.createCode]($backend) */ externalSourceAttachment = "bis:ExternalSourceAttachment", /** The name of the standard [[CodeSpec]] used when creating codes for [GeometryPart]($backend) elements. * @see [GeometryPart.createCode]($backend) */ geometryPart = "bis:GeometryPart", /** The name of the standard [[CodeSpec]] used when creating codes for [GraphicalType2d]($backend) elements. * @see [GraphicalType2d.createCode]($backend) */ graphicalType2d = "bis:GraphicalType2d", /** The name of the standard [[CodeSpec]] used when creating codes for [LineStyle]($backend) elements. * @see [LineStyle.createCode]($backend) */ lineStyle = "bis:LineStyle", /** The name of the standard [[CodeSpec]] used when creating codes for [LinkElement]($backend) elements. * @see [LinkElement.createCode]($backend) */ linkElement = "bis:LinkElement", /** The name of the standard [[CodeSpec]] used when creating codes for [ModelSelector]($backend) elements. * @see [ModelSelector.createCode]($backend) */ modelSelector = "bis:ModelSelector", /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalMaterial]($backend) elements. * @see [PhysicalMaterial.createCode]($backend) */ physicalMaterial = "bis:PhysicalMaterial", /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalType]($backend) elements. * @see [PhysicalType.createCode]($backend) */ physicalType = "bis:PhysicalType", /** The name of the standard [[CodeSpec]] used when creating codes for [InformationPartitionElement]($backend) elements. * @see [InformationPartitionElement.createCode]($backend) */ informationPartitionElement = "bis:InformationPartitionElement", /** The name of the standard [[CodeSpec]] used when creating codes for [RenderMaterialElement]($backend) elements. * @see [RenderMaterialElement.createCode]($backend) */ renderMaterial = "bis:RenderMaterial", /** The name of the standard [[CodeSpec]] used when creating codes for [Sheet]($backend) elements. * @see [Sheet.createCode]($backend) */ sheet = "bis:Sheet", /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialCategory]($backend) elements. * @see [SpatialCategory.createCode]($backend) */ spatialCategory = "bis:SpatialCategory", /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialLocationType]($backend) elements. * @see [SpatialLocationType.createCode]($backend) */ spatialLocationType = "bis:SpatialLocationType", /** The name of the standard [[CodeSpec]] used when creating codes for [SubCategory]($backend) elements. * @see [SubCategory.createCode]($backend) */ subCategory = "bis:SubCategory", /** The name of the standard [[CodeSpec]] used when creating codes for [Subject]($backend) elements. * @see [Subject.createCode]($backend) */ subject = "bis:Subject", /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe2d]($backend) elements. * @see [TemplateRecipe2d.createCode]($backend) */ templateRecipe2d = "bis:TemplateRecipe2d", /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe3d]($backend) elements. * @see [TemplateRecipe3d.createCode]($backend) */ templateRecipe3d = "bis:TemplateRecipe3d", /** @internal */ textAnnotationSeed = "bis:TextAnnotationSeed", /** The name of the standard [[CodeSpec]] used when creating codes for [Texture]($backend) elements. * @see [Texture.createCode]($backend) */ texture = "bis:Texture", /** The name of the standard [[CodeSpec]] used when creating codes for [ViewDefinition]($backend) elements. * @see [ViewDefinition.createCode]($backend) */ viewDefinition = "bis:ViewDefinition" } /** The scope of the Code. * @public */ export declare namespace CodeScopeSpec { /** The standard ways the CodeScope can be specified. * @public */ enum Type { /** The Code value must be unique within (at least) the iModel repository */ Repository = 1, /** The Code value must be unique within the scope of the Model */ Model = 2, /** The Code value must be unique among other children of the same parent element */ ParentElement = 3, /** The Code value must be unique among other elements also scoped by the same element */ RelatedElement = 4 } /** Requirements for how the CodeScope Element is identified. * @public */ enum ScopeRequirement { /** The Code is required to have a valid ElementId as its scope */ ElementId = 1, /** The Code is required to have a valid FederationGuid as its scope */ FederationGuid = 2 } } /** A [Code Specification]($docs/bis/intro/glossary#codespec) captures the rules for encoding and decoding significant business information into * and from a Code (string). This specification is used to generate and validate Codes. * * A CodeSpec defines the format of a Code for a certain type of Element in an IModel. * A CodeSpec can identify an external system that maintains and/or assigns Codes. * @public */ export declare class CodeSpec { /** The iModel holding this CodeSpec. */ iModel: IModel; /** The id of this CodeSpec. */ id: Id64String; /** The name of this CodeSpec. */ name: string; /** The JSON properties for this CodeSpec. * > Note: Use the getters and setters instead of accessing this directly. * @internal */ properties: any; /** Internal-only constructor. Proper use is to supply `properties` only or `scopeType` and `scopeReq` but not `properties`. * > Note: The deprecation has to do with moving the constructor from public to internal * @deprecated Use [[create]] or [[createFromJson]] instead of the internal constructor * @internal */ constructor(iModel: IModel, id: Id64String, name: string, scopeType?: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement, properties?: any); /** Create a new CodeSpec from the specified parameters * > Note: CodeSpec.id will not be valid until inserted * @see [CodeSpecs.insert]($backend) */ static create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec; /** Create a new CodeSpec directly from JSON. Used internally by the CodeSpecs.load function. * @internal */ static createFromJson(iModel: IModel, id: Id64String, name: string, properties: any): CodeSpec; /** Will be true if the id of this CodeSpec is valid. */ get isValid(): boolean; /** The scope type of this CodeSpec. * @deprecated Use scopeType instead. */ get specScopeType(): CodeScopeSpec.Type; set specScopeType(scopeType: CodeScopeSpec.Type); /** The scope type of this CodeSpec. */ get scopeType(): CodeScopeSpec.Type; set scopeType(scopeType: CodeScopeSpec.Type); /** Will be `CodeScopeSpec.ScopeRequirement.FederationGuid` if the scoping element is required to have a FederationGuid or `CodeScopeSpec.ScopeRequirement.ElementId` otherwise (which is the default). */ get scopeReq(): CodeScopeSpec.ScopeRequirement; set scopeReq(req: CodeScopeSpec.ScopeRequirement); /** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service. * @beta */ get isManagedWithIModel(): boolean; set isManagedWithIModel(value: boolean); } //# sourceMappingURL=Code.d.ts.map