package metadata

import "github.com/nexuscrm/shared/pkg/contract"

var _ contract.Metadata = (*ContractService)(nil)

// Dialects reach these through comma-ok type assertions, so a concrete type
// that stops satisfying one yields a nil reader rather than a compile or call
// error. The sf-crm dialect then fails its whole UI API closed and answers 500
// on every endpoint — loud at runtime, but invisible to every gate that runs
// before merge, because the assertion still compiles. These declarations move
// the failure to build time on the implementation side.
//
// That softness is also why the authoring read is its own interface: enlarging
// LayoutMetadataReader would break the assertion for the WHOLE interface in a
// dialect pinned to an older platform, costing every layout endpoint rather
// than only the new capability.
var _ contract.LayoutMetadataReader = (*ContractService)(nil)
var _ contract.LayoutAuthoringReader = (*ContractService)(nil)

// ContractService reaches MetadataService through a second comma-ok hop of its
// own (`s.metadata.(contractLayoutMetadataSource)`), which degrades to a
// runtime "layout metadata source unavailable" error. The assertions above
// cannot see that hop, so pin it here too.
var _ contractLayoutMetadataSource = (*MetadataService)(nil)
var _ contractLayoutAuthoringSource = (*MetadataService)(nil)

// The catalog pair has the identical shape and a wider blast radius — the sf-crm
// dialect binds it by comma-ok too and fails its whole UI API closed on a nil —
// but had no pin at all, so renaming ContractService.ListViews built green in
// every L0 module. Pinned, not split: unlike the layout case there is no new
// capability here, and these two methods mirror
// contract.ObjectMetadataCatalogReader exactly.
var _ contract.ObjectMetadataCatalogReader = (*ContractService)(nil)
var _ contractObjectMetadataCatalogSource = (*MetadataService)(nil)
