import { DomainRole } from './Domain'; import { LocationACLResponse } from './Location'; export type ResourceProfileResponse = { id: string; email: string; name: string; thumbnail_url: string; domain_id: string; domain_role: DomainRole; }; export type ResourceDomainResponse = { id: string; name: string; description: string; admin_profile: ResourceProfileResponse; }; export type ResourceACLResponse = { id: string; resource_id: string; profile_id: string; grant_profile_id: string | null; grant_domain_id: string | null; grant_scope: string | null; grant_folder_path: string[] | null; read_grant: boolean; update_grant: boolean; delete_grant: boolean; share_grant: boolean; full_grant: boolean; custom_access_grants: string[]; updated_at: string; created_at: string; r: { profile: ResourceProfileResponse; grant_profile: ResourceProfileResponse | null; }; }; export type ResourceResponse = { id: string; created_at: string; updated_at: string; deleted_at: string | null; parent_folder_id: string | null; last_activity_at: string | null; profile: ResourceProfileResponse; domain: ResourceDomainResponse | null; r?: { resource_acls: ResourceACLResponse[] | null; tags: TagResponse[] | null; }; }; export type ResourceProfile = { id: string; email: string; name: string; thumbnailUrl: string; domainId: string; domainRole: DomainRole; }; export type V5DeviceProfile = { id: string; email: string; name: string; thumbnailUrl: string; domainRole: DomainRole; }; export type V5DeviceProfileResponse = { id: string; email: string; name: string; thumbnail_url: string; domain_role: DomainRole; domain_id: string; }; export type ResourceDomain = { id: string; name: string; description: string; adminProfile: ResourceProfile; }; export type ResourceACL = { id: string; resourceId: string; profileId: string; grantProfileId: string | null; grantDomainId: string | null; grantScope: string | null; grantFolderPath: string[] | null; readGrant: boolean; updateGrant: boolean; deleteGrant: boolean; shareGrant: boolean; fullGrant: boolean; customAccessGrants: string[]; updatedAt: string; createdAt: string; r: { profile: ResourceProfile; grantProfile: ResourceProfile | null; }; }; type TagType = { id: string; resourceId: string; key: string; label: string; value: T['value']; type: T['type']; createdAt: string; }; export type TagText = TagType<{ value: string; type: 'text' }>; export type TagDate = TagType<{ value: string; type: 'date' }>; export type TagTime = TagType<{ value: string; type: 'time' }>; export type TagDay = TagType<{ value: Day[]; type: 'days_of_week' }>; export type Day = 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU'; type TagTypeResponse = { id: string; resource_id: string; key: string; label: string; value: T['value']; type: T['type']; created_at: string; }; export type TagTextResponse = TagTypeResponse<{ value: string; type: 'text'; }>; export type TagDateResponse = TagTypeResponse<{ value: string; type: 'date'; }>; export type TagDayResponse = TagTypeResponse<{ value: Day[]; type: 'days_of_week'; }>; export type TagTimeResponse = TagTypeResponse<{ value: string; type: 'time'; }>; export type TagResponse = | TagTextResponse | TagDateResponse | TagDayResponse | TagTimeResponse; export type Tag = TagText | TagDate | TagTime | TagDay; export type CreateTagType = Pick< T, 'key' | 'value' | 'label' | 'type' >; export type CreateTag = | CreateTagType | CreateTagType | CreateTagType | CreateTagType; export type CreateTagResponse = | CreateTagType | CreateTagType | CreateTagType | CreateTagType; export type Resource = { id: string; updatedAt: string; createdAt: string; deletedAt: string | null; lastActivityAt: string | null; parentFolderId: string | null; profile: ResourceProfile; domain: ResourceDomain | null; r: { resourceACLs: ResourceACL[]; tags: Tag[]; }; }; export type ResourceGrant = | 'read' | 'update' | 'delete' | 'share' | 'full' | 'publish'; type ACLRequestBase = T & { resource_id: string; grants: string[]; }; type ACLBase = T & { resourceId: string; grants: ResourceGrant[]; }; export type CreateResourceACL = | ACLBase<{ grantProfileId?: string }> | ACLBase<{ grantProfileEmail?: string }>; export type CreateResourceACLRequest = | ACLRequestBase<{ grant_profile_id?: string }> | ACLRequestBase<{ grant_profile_email?: string }>; export type CreateResourceACLResponse = ResourceACLResponse; export type DeleteResourceACLRequest = void; export type DeleteResourceACLResponse = void; export type ListResourceACLsRequest = void; export type ListResourceACLsResponse = ResourceACLResponse[]; // v2 types export interface ResourceV2Response { id: string; profile_id: string; domain_id: string | null; parent_folder_id: string | null; created_at: string; updated_at: string; deleted_at: string | null; r: { tags: TagResponse[] | null; }; } export interface ResourceV2 { id: string; profileId: string; domainId: string | null; parentFolderId: string | null; createdAt: string; updatedAt: string; deletedAt: string | null; r: { tags: Tag[]; }; } export type GrantIdentifiers = | { grantProfileIds: string[] } | { grantDomainId: string }; export type GrantIdentifiersRequest = | { grant_profile_ids: string[] } | { grant_domain_id: string }; export type CreateResourceACLV5Request = ACLRequestBase< GrantIdentifiersRequest >; export type CreateResourceACLV5 = ACLBase; export type CreateResourceACLV5Response = { acl: LocationACLResponse[]; }; export type UpdateResourceACLV5Request = CreateResourceACLV5Request; export type UpdateResourceACLV5 = CreateResourceACLV5; export type UpdateResourceACLV5Response = CreateResourceACLV5Response; export type DeleteResourceACLV5 = GrantIdentifiers; export type DeleteResourceACLV5Request = GrantIdentifiersRequest; export type DeleteResourceACLV5Response = void;