<commit_before>"""
byceps.services.shop.storefront.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 <NAME>
:License: Modified BSD, see LICENSE for details.
"""

from ....database import db
from ....util.instances import ReprBuilder

from ..sequence.transfer.models import NumberSequenceID
from ..shop.transfer.models import ShopID

from .transfer.models import StorefrontID


class Storefront(db.Model):
    """A storefront.

    The entrypoint from a site to a shop.
    """

    __tablename__ = 'shop_storefronts'

    id = db.Column(db.UnicodeText, primary_key=True)
    shop_id = db.Column(db.UnicodeText, db.ForeignKey('shops.id'), nullable=False)
    order_number_sequence_id = db.Column(db.Uuid, db.ForeignKey('shop_sequences.id'), nullable=False)
    closed = db.Column(db.Boolean, nullable=False)

    def __init__(
        self,
        storefront_id: StorefrontID,
        shop_id: ShopID,
        order_number_sequence_id: NumberSequenceID,
        closed: bool,
    ) -> None:
        self.id = storefront_id
        self.shop_id = shop_id
        self.order_number_sequence_id = order_number_sequence_id
        self.closed = closed

    def __repr__(self) -> str:
        return ReprBuilder(self) \
            .add_with_lookup('id') \
            .add_with_lookup('shop_id') \<commit_msg>Add index for storefront's shop ID<commit_after>"""
byceps.services.shop.storefront.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 <NAME>
:License: Modified BSD, see LICENSE for details.
"""

from ....database import db
from ....util.instances import ReprBuilder

from ..sequence.transfer.models import NumberSequenceID
from ..shop.transfer.models import ShopID

from .transfer.models import StorefrontID


class Storefront(db.Model):
    """A storefront.

    The entrypoint from a site to a shop.
    """

    __tablename__ = 'shop_storefronts'

    id = db.Column(db.UnicodeText, primary_key=True)
    shop_id = db.Column(db.UnicodeText, db.ForeignKey('shops.id'), index=True, nullable=False)
    order_number_sequence_id = db.Column(db.Uuid, db.ForeignKey('shop_sequences.id'), nullable=False)
    closed = db.Column(db.Boolean, nullable=False)

    def __init__(
        self,
        storefront_id: StorefrontID,
        shop_id: ShopID,
        order_number_sequence_id: NumberSequenceID,
        closed: bool,
    ) -> None:
        self.id = storefront_id
        self.shop_id = shop_id
        self.order_number_sequence_id = order_number_sequence_id
        self.closed = closed

    def __repr__(self) -> str:
        return ReprBuilder(self) \
            .add_with_lookup('id') \
            .add_with_lookup('shop_id') \
{'fraction_non_alphanumeric': 0.13390525923163, 'fraction_numerical': 0.005967922417008579, 'mean_word_length': 3.2236220472440946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2480993', 'n_tokens_mistral': 857, 'n_tokens_neox': 822, 'n_words': 180}