/* * Copyright 2025 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import type { BaseCollection, BaseModel, EntitlementProductCode, Organization, Site, } from '../index'; export type SiteImsOrgAccessRole = 'collaborator' | 'agency' | 'viewer'; export interface SiteImsOrgAccess extends BaseModel { getSite(): Promise; getOrganization(): Promise; getSiteId(): string; /** organizationId is the delegate org receiving access (read-only, part of grant identity). */ getOrganizationId(): string; /** targetOrganizationId is the site-owning org (read-only, part of grant identity). */ getTargetOrganizationId(): string; /** productCode is read-only; changing scope requires a new grant. */ getProductCode(): EntitlementProductCode; getRole(): SiteImsOrgAccessRole; getGrantedBy(): string | null; getExpiresAt(): string | null; setRole(role: SiteImsOrgAccessRole): SiteImsOrgAccess; setGrantedBy(grantedBy: string): SiteImsOrgAccess; setExpiresAt(expiresAt: string): SiteImsOrgAccess; } export interface SiteImsOrgAccessGrantWithTarget { grant: SiteImsOrgAccess; targetOrganization: { id: string; imsOrgId: string; }; } export interface SiteImsOrgAccessGrantWithSite { grant: SiteImsOrgAccess; /** Site model instance. Null only if the FK is broken (should not occur given ON DELETE CASCADE). */ site: Site | null; } export interface SiteImsOrgAccessCollection extends BaseCollection { allBySiteId(siteId: string): Promise; allByOrganizationId(organizationId: string): Promise; allByTargetOrganizationId(targetOrganizationId: string): Promise; allByOrganizationIdWithTargetOrganization(organizationId: string): Promise; allByOrganizationIdsWithTargetOrganization(organizationIds: string[]): Promise; allByOrganizationIdWithSites(organizationId: string): Promise; findBySiteId(siteId: string): Promise; findByOrganizationId(organizationId: string): Promise; findByTargetOrganizationId(targetOrganizationId: string): Promise; findBySiteIdAndOrganizationIdAndProductCode(siteId: string, organizationId: string, productCode: EntitlementProductCode): Promise; }