{"version":3,"file":"asset.schema.cjs","sources":["../../../../../src/schema/public/asset/asset.schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport zodToCamelCase from \"zod-to-camel-case\";\n\nimport {\n  _stateSchema,\n  newState,\n  publishedState,\n  timestampsSchema,\n} from \"@/schema/public/components/base/base.schema\";\n\nexport const assetTypeSchema = z.enum([\n  \"lesson_guide\",\n  \"downloadable_file\",\n  \"slidedeck\",\n  \"worksheet\",\n  \"worksheet_answers\",\n  \"supplementary_resource\",\n]);\n\nexport type AssetTypeType = z.infer<typeof assetTypeSchema>;\n\nexport const googleSchema = z.object({\n  id: z.string().nullable(),\n  url: z.url().nullable(),\n});\n\nexport type GoogleType = z.infer<typeof googleSchema>;\n\nexport const bucketSchema = z.object({\n  bucket_name: z.string().nullable(),\n  bucket_path: z.string().nullable(),\n});\n\nexport type BucketType = z.infer<typeof bucketSchema>;\n\nexport const assetObjectSchema = z\n  .object({\n    pdf: bucketSchema,\n    powerpoint: bucketSchema,\n    opendocument_presentation: bucketSchema,\n    google_drive: googleSchema,\n    google_slide: googleSchema.pick({ url: true }),\n  })\n  .partial();\n\nexport type AssetObjectType = z.infer<typeof assetObjectSchema>;\n\nexport const assetSchema = timestampsSchema.extend({\n  asset_id: z.number(),\n  asset_uid: z.string(),\n  _state: _stateSchema,\n  title: z.string(),\n  description: z.string(),\n  asset_type: assetTypeSchema,\n  url: z.url(),\n  asset_object: assetObjectSchema,\n  tpc_media_ids: z.array(z.number()).nullable(),\n  tpc_works_ids: z.array(z.number()).nullable(),\n});\nexport type Asset = z.infer<typeof assetSchema>;\n\nexport const assetNewSchema = assetSchema\n  .pick({\n    asset_id: true,\n    asset_uid: true,\n    asset_type: true,\n    asset_object: true,\n    tpc_media_ids: true,\n    tpc_works_ids: true,\n    created_at: true,\n    updated_at: true,\n  })\n  .extend({\n    _state: newState,\n    url: z.url().nullable(),\n    title: z.string().nullable(),\n    description: z.string().nullable(),\n  });\nexport type AssetNew = z.infer<typeof assetNewSchema>;\n\nexport const assetPublishedSchema = assetSchema.extend({\n  _state: publishedState,\n});\nexport type AssetPublished = z.infer<typeof assetPublishedSchema>;\n\nexport const googleSchemaCamel = zodToCamelCase(googleSchema);\nexport type GoogleTypeCamel = z.infer<typeof googleSchemaCamel>;\n\nexport const bucketSchemaCamel = zodToCamelCase(bucketSchema);\nexport type BucketTypeCamel = z.infer<typeof bucketSchemaCamel>;\n\nexport const assetSchemaCamel = zodToCamelCase(assetSchema);\nexport type AssetCamel = z.infer<typeof assetSchemaCamel>;\n\nexport const assetNewSchemaCamel = zodToCamelCase(assetNewSchema);\nexport type AssetNewCamel = z.infer<typeof assetNewSchemaCamel>;\n\nexport const assetPublishedSchemaCamel = zodToCamelCase(assetPublishedSchema);\nexport type AssetPublishedCamel = z.infer<typeof assetPublishedSchemaCamel>;\n\nexport const assetObjectSchemaCamel = zodToCamelCase(assetObjectSchema);\nexport type AssetObjectTypeCamel = z.infer<typeof assetObjectSchemaCamel>;\n\n// Backwards compatibility exports\n/**\n * @deprecated Use assetSchema instead.\n */\nexport const assetsSchema = assetSchema;\nexport type AssetType = Asset;\n"],"names":["assetTypeSchema","z","enum","googleSchema","object","id","string","nullable","url","bucketSchema","bucket_name","bucket_path","assetObjectSchema","pdf","powerpoint","opendocument_presentation","google_drive","google_slide","pick","partial","assetSchema","timestampsSchema","extend","asset_id","number","asset_uid","_state","_stateSchema","title","description","asset_type","asset_object","tpc_media_ids","array","tpc_works_ids","assetNewSchema","created_at","updated_at","newState","assetPublishedSchema","publishedState","googleSchemaCamel","zodToCamelCase","bucketSchemaCamel","assetSchemaCamel","assetNewSchemaCamel","assetPublishedSchemaCamel","assetObjectSchemaCamel","assetsSchema"],"mappings":"+KAUO,MAAMA,EAAkBC,EAAAA,EAAEC,KAAK,CACpC,eACA,oBACA,YACA,YACA,oBACA,2BAKWC,EAAeF,EAAAA,EAAEG,OAAO,CACnCC,GAAIJ,EAAAA,EAAEK,SAASC,WACfC,IAAKP,EAAAA,EAAEO,MA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