# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .citation_parameters_style import CitationParametersStyle
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class CitationParameters(UniversalBaseModel):
    """
    Style the generator should use when making citations.
    """

    style: typing.Optional[CitationParametersStyle] = pydantic.Field(default=None)
    """
    The citation style to be used in summary.
    Can be one of:
    * `numeric` - Citations formatted as simple numerals: \[1\], \[2\] ...
    * `none` - Citations removed from text.
    * `html` - Citation formatted as a URL like `<a href="url_pattern">text_pattern</a>`.
    * `markdown` - Formatted as `[text_pattern](url_pattern)`.
    """

    url_pattern: typing.Optional[str] = pydantic.Field(default=None)
    """
    The URL pattern if the citation_style is set to `html` or `markdown`.
    The pattern can access metadata attributes in the document or part.
    e.g. `https://my.doc/foo/{doc.id}/{part.id}`
    
    The default `url_pattern` is an empty string.
    """

    text_pattern: typing.Optional[str] = pydantic.Field(default=None)
    """
    The text pattern if the citation_style is set to `html` or `markdown`.
    This pattern sets the href for HTML or the text within `[]` in markdown,
    and defaults to N being the index of result if it is not set.
    
    The default citation style looks like `[N](<url_pattern>)` for markdown.
    
    You can use metadata attributes in the `text_pattern`. For example,
    the pattern `{doc.title}` with citation style `markdown` would result
    in final citation output like `[Title](<url_pattern>)` when
    the document's metadata includes `{"title":"Title"}`.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
