Skip to main content

Crate legalis_th

Crate legalis_th 

Source
Expand description

Comprehensive Thai legal framework implementation in Pure Rust.

§Overview

Thailand operates under a Civil Law system with Buddhist influence. This library provides validation, types, and utilities for key Thai legislation:

DomainLawYear (B.E./CE)Key Provisions
Constitutionรัฐธรรมนูญ2560/2017Fundamental rights, monarchy, Buddhism
Civil & Commercialประมวลกฎหมายแพ่งและพาณิชย์2535/1992Obligations, contracts, property, family
Foreign Businessพ.ร.บ. ประกอบธุรกิจของคนต่างด้าว2542/1999Foreign ownership restrictions
Laborพ.ร.บ. คุ้มครองแรงงาน2541/199848h/week, severance, SSF
Data Protectionพ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล (PDPA)2562/2019Thailand’s GDPR
Investmentพ.ร.บ. ส่งเสริมการลงทุน (BOI)2520/1977Tax incentives, EEC
Landประมวลกฎหมายที่ดิน2497/1954Foreign ownership restrictions

§Buddhist Era Calendar (พุทธศักราช - พ.ศ.)

Thailand uses the Buddhist Era calendar for all legal documents. The Buddhist Era is 543 years ahead of the Common Era.

use legalis_th::calendar::{ce_to_be, be_to_ce, BuddhistYear, BuddhistDate};

// Convert between calendars
assert_eq!(ce_to_be(2024), 2567);
assert_eq!(be_to_ce(2562), 2019); // PDPA year

// Create Buddhist dates
let date = BuddhistDate::new(15, 6, 2567).expect("valid date");
assert_eq!(date.format_th(), "15 มิถุนายน พ.ศ. 2567");

Thai legal citations follow specific formats:

use legalis_th::citation::{ThaiAct, ThaiConstitution};
use legalis_th::calendar::BuddhistYear;

// Act citation
let pdpa = ThaiAct::new(
    "คุ้มครองข้อมูลส่วนบุคคล",
    "Personal Data Protection Act",
    BuddhistYear::from_be(2562),
);
assert_eq!(pdpa.format_th(), "พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562");

// Section reference
let section = pdpa.section(26);
assert_eq!(section.format_th(), "พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562 มาตรา 26");

// Constitution citation
let constitution = ThaiConstitution::current(); // 2560/2017
assert_eq!(constitution.format_th(), "รัฐธรรมนูญแห่งราชอาณาจักรไทย พ.ศ. 2560");

§Foreign Business Act (FBA) - พ.ร.บ. ประกอบธุรกิจของคนต่างด้าว พ.ศ. 2542

Three-tier restriction system for foreign businesses:

ListRestrictionExamples
List 1ProhibitedMedia, land trading, forestry
List 2Cabinet approval requiredArms, domestic transport
List 3License requiredRetail, construction, legal services

Exemptions available for:

  • BOI-promoted investments
  • ASEAN treaty benefits
  • US Treaty of Amity

§Labor Protection Act (LPA) - พ.ร.บ. คุ้มครองแรงงาน พ.ศ. 2541

ProvisionDetails
Working Hours48h/week maximum (8h/day, 6 days)
OvertimeMax 36h/week with consent
Rest DaysMinimum 1 day/week
Public HolidaysMinimum 13 days/year
Annual Leave6+ days after 1 year
Sick LeaveUp to 30 days/year with pay
Severance30-400 days based on tenure

§Personal Data Protection Act (PDPA) - พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562

AspectPDPA (Thailand)
Legal Bases6 (consent, contract, legal obligation, vital interests, public task, legitimate interests)
Data Subject Rights8 (access, rectification, erasure, restriction, portability, objection, automated decisions)
Breach Notification72 hours to PDPC
AuthorityPDPC (Personal Data Protection Committee)
PenaltiesUp to 5M THB (admin), 1M THB (criminal)

§Board of Investment (BOI) - คณะกรรมการส่งเสริมการลงทุน

Incentive CategoryCIT ExemptionImport DutyOther
A1 (High Priority)8 years + 50% 5 years0%Zone benefits
A28 years0%Zone benefits
A35 years0%-
A43 years0%-
B1-B20 years0%Import duty only

§Module Structure

§Core Infrastructure

  • calendar - Buddhist Era calendar system
  • citation - Thai legal citation formatting

§Civil and Commercial Law

  • civil_commercial_code - CCC Books I-VI (General, Obligations, Contracts, Commercial, Family, Succession)

§Business and Investment

§Labor and Employment

§Data and Consumer Protection

§Tax and Customs

  • tax_law - Revenue Code (CIT, PIT, VAT) and Customs

§Criminal and Procedural Law

§Regulatory and Specialized Law

§Bilingual Support

All types support both Thai (authoritative) and English:

use legalis_th::citation::ThaiCourtLevel;

let court = ThaiCourtLevel::SupremeCourt;
assert_eq!(court.name_th(), "ศาลฎีกา");
assert_eq!(court.name_en(), "Supreme Court");

§References

Re-exports§

pub use calendar::BE_CE_OFFSET;
pub use calendar::BuddhistDate;
pub use calendar::BuddhistYear;
pub use calendar::ThaiEra;
pub use calendar::be_to_ce;
pub use calendar::ce_to_be;
pub use calendar::format_buddhist_year;
pub use calendar::format_buddhist_year_en;
pub use citation::ThaiAct;
pub use citation::ThaiActSection;
pub use citation::ThaiCitation;
pub use citation::ThaiConstitution;
pub use citation::ThaiConstitutionSection;
pub use citation::ThaiCourtDecision;
pub use citation::ThaiCourtLevel;
pub use citation::ThaiLegalInstrumentType;
pub use data_protection::DataCategory;
pub use data_protection::DataSubjectRight;
pub use data_protection::LegalBasis;
pub use data_protection::PdpaCompliance;
pub use data_protection::PdpaError;
pub use data_protection::PdpaResult;
pub use data_protection::PersonalDataProcessing;
pub use data_protection::ProcessingPurpose;
pub use foreign_business::BusinessActivity;
pub use foreign_business::BusinessRestrictionList;
pub use foreign_business::FbaCompliance;
pub use foreign_business::FbaError;
pub use foreign_business::FbaResult;
pub use foreign_business::ForeignBusinessLicense;
pub use foreign_business::OwnershipStructure;
pub use labor_law::EmploymentContract;
pub use labor_law::EmploymentType;
pub use labor_law::LaborCompliance;
pub use labor_law::LpaError;
pub use labor_law::LpaResult;
pub use labor_law::Severance;
pub use labor_law::TerminationType;
pub use labor_law::WorkingHours;
pub use civil_commercial_code::AdoptionRequirement;
pub use civil_commercial_code::AgentType;
pub use civil_commercial_code::BuyerObligation;
pub use civil_commercial_code::CommercialAct;
pub use civil_commercial_code::CommercialBusiness;
pub use civil_commercial_code::CommercialRegistrationType;
pub use civil_commercial_code::Contract;
pub use civil_commercial_code::ContractRemedy;
pub use civil_commercial_code::ContractRequirement;
pub use civil_commercial_code::DamagesType;
pub use civil_commercial_code::DisinheritanceGround;
pub use civil_commercial_code::DivorceGround;
pub use civil_commercial_code::DomicileType;
pub use civil_commercial_code::Estate;
pub use civil_commercial_code::HeirClass;
pub use civil_commercial_code::InterpretationPrinciple;
pub use civil_commercial_code::JuristicActValidity;
pub use civil_commercial_code::LeaseContract;
pub use civil_commercial_code::LeaseType;
pub use civil_commercial_code::LegalCapacity;
pub use civil_commercial_code::LimitationPeriod;
pub use civil_commercial_code::Marriage;
pub use civil_commercial_code::MarriageRequirement;
pub use civil_commercial_code::ObligationPerformance;
pub use civil_commercial_code::ObligationSource;
pub use civil_commercial_code::Person;
pub use civil_commercial_code::PropertyRegime;
pub use civil_commercial_code::SaleContract;
pub use civil_commercial_code::SecurityType;
pub use civil_commercial_code::SellerObligation;
pub use civil_commercial_code::SpecificContract;
pub use civil_commercial_code::SpouseShare;
pub use civil_commercial_code::TortLiability;
pub use civil_commercial_code::VoidableGround;
pub use civil_commercial_code::WillType;
pub use criminal_code::AggravatingCircumstance;
pub use criminal_code::CriminalResponsibility;
pub use criminal_code::MitigatingCircumstance;
pub use criminal_code::OffenseCategory;
pub use criminal_code::Punishment;
pub use criminal_code::StatuteOfLimitations;
pub use tax_law::CITRate;
pub use tax_law::CustomsDutyType;
pub use tax_law::CustomsProcedure;
pub use tax_law::FilingPeriod;
pub use tax_law::PITBracket;
pub use tax_law::PreferentialScheme;
pub use tax_law::TaxType;
pub use tax_law::VAT_REGISTRATION_THRESHOLD;
pub use tax_law::VATRate;
pub use tax_law::ValuationMethod;
pub use investment_promotion::BOIIncentive;
pub use investment_promotion::EECZone;
pub use investment_promotion::InvestmentZone;
pub use investment_promotion::PromotionCategory;
pub use intellectual_property::CopyrightWork;
pub use intellectual_property::IPType;
pub use intellectual_property::InfringementType;
pub use intellectual_property::PatentType;
pub use intellectual_property::TrademarkClass;
pub use immigration::ExtensionType;
pub use immigration::NINETY_DAY_REPORTING_REQUIRED;
pub use immigration::OverstayPenalty;
pub use immigration::VisaType;
pub use immigration::WorkPermitCategory;
pub use land_code::CONDO_FOREIGN_QUOTA_PERCENT;
pub use land_code::ForeignOwnershipRule;
pub use land_code::LandDocument;
pub use land_code::LandRight;
pub use land_code::LandUseZone;
pub use land_code::MAX_LEASE_RENEWALS;
pub use land_code::MAX_LEASE_TERM_YEARS;
pub use company_act::CompanyType;
pub use company_act::DirectorType;
pub use company_act::MIN_PAID_UP_CAPITAL_PERCENT;
pub use company_act::MIN_PUBLIC_COMPANY_CAPITAL;
pub use company_act::MeetingType;
pub use company_act::QuorumRequirement;
pub use company_act::ShareholderRight;
pub use securities_law::DisclosureType;
pub use securities_law::MarketType;
pub use securities_law::ProhibitedAct;
pub use securities_law::SecuritiesType;
pub use consumer_protection::ConsumerRight;
pub use consumer_protection::ProductStandard;
pub use consumer_protection::UnfairTerm;
pub use bankruptcy::ActOfBankruptcy;
pub use bankruptcy::BankruptcyType;
pub use bankruptcy::CreditorPriority;
pub use bankruptcy::MIN_DEBT_THRESHOLD;
pub use arbitration::ArbitrationInstitution;
pub use arbitration::ArbitrationType;
pub use arbitration::NEW_YORK_CONVENTION_RATIFIED;
pub use arbitration::SetAsideGround;
pub use competition_law::AbuseOfDominance;
pub use competition_law::MARKET_DOMINANCE_THRESHOLD_PERCENT;
pub use competition_law::MERGER_NOTIFICATION_THRESHOLD_THB;
pub use competition_law::ProhibitedPractice;

Modules§

arbitration
Arbitration Act - พ.ร.บ. อนุญาโตตุลาการ พ.ศ. 2545
bankruptcy
Bankruptcy Act - พ.ร.บ. ล้มละลาย พ.ศ. 2483
calendar
Buddhist Era (พุทธศักราช - พ.ศ.) Calendar System for Thailand
citation
Thai Legal Citation System (การอ้างอิงกฎหมายไทย)
civil_commercial_code
Thai Civil and Commercial Code (CCC) - ประมวลกฎหมายแพ่งและพาณิชย์ พ.ศ. 2535
company_act
Public Limited Companies Act - พ.ร.บ. บริษัทมหาชนจำกัด พ.ศ. 2535
competition_law
Trade Competition Act - พ.ร.บ. การแข่งขันทางการค้า พ.ศ. 2560
consumer_protection
Consumer Protection Act - พ.ร.บ. คุ้มครองผู้บริโภค พ.ศ. 2522
criminal_code
Thai Criminal Code - ประมวลกฎหมายอาญา พ.ศ. 2499
data_protection
Thai Personal Data Protection Act (PDPA) - พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562
foreign_business
Thai Foreign Business Act (FBA) - พ.ร.บ. ประกอบธุรกิจของคนต่างด้าว พ.ศ. 2542
immigration
Thai Immigration Act - พ.ร.บ. คนเข้าเมือง พ.ศ. 2522
intellectual_property
Thai Intellectual Property Law
investment_promotion
Board of Investment (BOI) - คณะกรรมการส่งเสริมการลงทุน พ.ร.บ. ส่งเสริมการลงทุน พ.ศ. 2520
labor_law
Thai Labor Protection Act (LPA) - พ.ร.บ. คุ้มครองแรงงาน พ.ศ. 2541
land_code
Thai Land Code - ประมวลกฎหมายที่ดิน พ.ศ. 2497
securities_law
Securities and Exchange Act - พ.ร.บ. หลักทรัพย์และตลาดหลักทรัพย์ พ.ศ. 2535
tax_law
Thai Tax Law - กฎหมายภาษีอากร