package metadata

import (
	"github.com/nexuscrm/shared/pkg/constants"
	"github.com/nexuscrm/shared/pkg/models"
)

func fieldPhysicalNullable(field *models.FieldMetadata) bool {
	if field == nil {
		return true
	}
	if field.IsSystem {
		return !field.Required
	}
	if field.IsMasterDetail || constants.NormalizeFieldType(string(field.Type)) == constants.FieldTypeMasterDetail {
		return false
	}
	return true
}
